sphinxcontrib_rust.directives
Module for all the directive classes of the Rust domain
Classes
|
Directive for handling crate documentation |
|
Base class for Rust directives. |
|
Directive for handling enum documentation |
|
Directive for handling executable documentation |
|
Directive for handling function documentation |
|
Directive for handling function documentation |
|
Directive for handling function documentation |
|
Directive for handling module documentation |
|
Directive for handling struct documentation |
|
Directive for handling trait documentation |
|
Directive for handling type documentation |
|
Directive for handling the use statements in the file. |
|
Directive for handling type documentation |
- class sphinxcontrib_rust.directives.RustCrateDirective(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine)
Directive for handling crate documentation
- property rust_item_type: RustItemType
The Rust object type for the directive
- class sphinxcontrib_rust.directives.RustDirective(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine)
Base class for Rust directives.
This class implements most of the logic for the directives. For each directive, there is a subclass that overrides any directive specific behaviour.
The input for the directives is generated with the Rust code in
sphinx-rustdocgen::directives- add_target_and_index(name: Sequence[str], sig: str, signode: desc_signature) None
Adds the item to the domain and generates the index for it.
This is called after
handle_signature()has executed.- Args:
- name:
The name of the item, which is the return value from
handle_signature().- sig:
The argument to the directive, which is the Rust path of the item set by the Rust doc generator.
- signode:
The docutils node of the for item.
- classmethod get_directives() dict[RustItemType, Type[RustDirective]]
Get all the directives for the object types
- get_signatures() list[str]
Override the default get_signatures method, which splits the signatures by line.
Currently, only one signature is allowed for each Rust object, and due to the use of where on new lines, it is all part of one signature. Only the final newline is removed.
- See Also:
- handle_signature(sig: str, signode: desc_signature) ObjDescT
Handle the directive and generate its display signature.
The display signature is what is displayed instead of the directive name and options in the generated output. The
:sig:option of the directive is used to override the providedsigvalue. If the option is not set, the item type and the final component of the path are used.Raising
ValueErrorwill put thesigvalue into a single node, which is what the super implementation does.- Args:
- sig:
The argument of the directive as set during doc generation, not the
:sig:option. The Rust side of the code will put the full Rust path of the item as the argument.- signode:
The docutils node for the item, to which the display signature nodes should be appended.
- Returns:
The path for the object, which is a tuple of the Rust path components and defines the hierarchy of the object for indexing.
- option_spec: ClassVar[OptionSpec] = {'index': <function RustDirective.<lambda>>, 'layout': <function unchanged>, 'sig': <function unchanged>, 'toc': <function unchanged>, 'vis': <function unchanged_required>}
Mapping of option names to validator functions.
- abstract property rust_item_type: RustItemType
The Rust object type for the directive
- class sphinxcontrib_rust.directives.RustEnumDirective(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine)
Directive for handling enum documentation
- property rust_item_type: RustItemType
The Rust object type for the directive
- class sphinxcontrib_rust.directives.RustExecutableDirective(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine)
Directive for handling executable documentation
- property rust_item_type: RustItemType
The Rust object type for the directive
- class sphinxcontrib_rust.directives.RustFunctionDirective(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine)
Directive for handling function documentation
- property rust_item_type: RustItemType
The Rust object type for the directive
- class sphinxcontrib_rust.directives.RustImplDirective(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine)
Directive for handling function documentation
- property rust_item_type: RustItemType
The Rust object type for the directive
- class sphinxcontrib_rust.directives.RustMacroDirective(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine)
Directive for handling function documentation
- property rust_item_type: RustItemType
The Rust object type for the directive
- class sphinxcontrib_rust.directives.RustModuleDirective(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine)
Directive for handling module documentation
- property rust_item_type: RustItemType
The Rust object type for the directive
- class sphinxcontrib_rust.directives.RustStructDirective(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine)
Directive for handling struct documentation
- property rust_item_type: RustItemType
The Rust object type for the directive
- class sphinxcontrib_rust.directives.RustTraitDirective(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine)
Directive for handling trait documentation
- property rust_item_type: RustItemType
The Rust object type for the directive
- class sphinxcontrib_rust.directives.RustTypeDirective(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine)
Directive for handling type documentation
- property rust_item_type: RustItemType
The Rust object type for the directive
- class sphinxcontrib_rust.directives.RustUseDirective(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine)
Directive for handling the use statements in the file.
When the directive is encountered, all the options to the directive are added to the domain data for the document as potential links.
This is not an object description and does not inherit from
RustDirective. It also has no content.- group_arguments() list[tuple[str, str]]
Collect data into non-overlapping fixed-length chunks or blocks.
- has_content = False
May the directive have content?
- optional_arguments = 999
Number of optional arguments after the required arguments.
- class sphinxcontrib_rust.directives.RustVariableDirective(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine)
Directive for handling type documentation
- property rust_item_type: RustItemType
The Rust object type for the directive