mod module_directive
- module module_directive
Implementation of the
rust:moduledirectiveFunctions
- fn has_test_token(tokens: &str) -> bool
- fn is_test_module(item_mod: &ItemMod) -> bool
Determines if the module is a test module or not.
Structs and Unions
- struct ModuleDirective
Struct to hold data for a module’s documentation.
- name: String
The full path to the module.
- options: Vec<DirectiveOption>
The options for the module directive.
- content: Vec<String>
The docstring for the module.
- items: Vec<Directive>
The items defined within the module.
- ident: String
The identifier of the module (i.e. the final portion of name).
- visibility: Visibility
The visibility of the module.
Impls
- impl ModuleDirective
- const DIRECTIVE_NAME: &'static str
- fn new(module_name: &str, ast: &File, visibility: Visibility) -> ModuleDirective
Create a new
ModuleDirectivefrom name, AST and visibility.- Args:
- module_name:
The full path to the module, starting with the crate name.
- ast:
The
syn::Filereference from parsing the module’s file.- visibility:
The visibility of the module. This is typically determined when the parent module is parsed.
- fn from_item(parent_path: &str, item: &ItemMod) -> Option<Directive>
Create a
sphinx-rustdocgen::directives::Directive::Modulefrom the item, if the module is not a test module.ItemModis both a mod declaration and mod definition. When it is only a declaration likepub mod foo;, there are no items but the visibility is known. If it is an inline definition, both items and visibility are available. If the returned value has an emptyitemsvec, only the declaration was provided, and the module definition is in a separate file. In such cases, the module content should be updated later using thesphinx-rustdocgen::directives::module_directive::ModuleDirective::update_items.- Args:
- parent_path:
The path of the module’s parent module or the crate name.
- item:
The
ItemModparsed out bysyn.
- Returns:
A
Somevalue if the module is not a test module, otherwiseNone.