mod module_directive

module module_directive

Implementation of the rust:module:: directive

Functions

fn is_test_module (item_mod : & ItemMod) -> bool

Determines if the module is a test module or not.

Structs

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
fn new (module_name : & str , ast : & File , visibility : Visibility) -> ModuleDirective

Create a new ModuleDirective from name, AST and visibility.

Args:
module_name:

The full path to the module, starting with the crate name.

ast:

The syn::File reference 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::Module from the item, if the module is not a test module.

ItemMod is both a mod declaration and mod definition. When it is only a declaration like pub 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 empty items vec, 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 the sphinx-rustdocgen::directives::module_directive::ModuleDirective::update_items.

Args:
parent_path:

The path of the module’s parent module or the crate name.

item:

The ItemMod parsed out by syn.

Returns:

A Some value if the module is not a test module, otherwise None.

impl MdDirective for ModuleDirective
fn get_md_text (self , fence_size : usize , max_visibility : & DirectiveVisibility) -> Vec < String >
fn fence_size (& self) -> usize
impl RstDirective for ModuleDirective
fn get_rst_text (self , level : usize , max_visibility : & DirectiveVisibility) -> Vec < String >