sphinxcontrib_rust.domain
Module for the rust Sphinx domain for documentation Rust items
Classes
|
The Sphinx domain for the Rust programming language. |
|
An |
- class sphinxcontrib_rust.domain.RustDomain(env: BuildEnvironment)
The Sphinx domain for the Rust programming language.
The domain provides the various roles and directives that can be used in the Sphinx documentation for linking with Rust code.
- clear_doc(docname: str) None
Remove traces of a document in the domain-specific inventories.
- data: dict[str, dict[RustItemType, list[RustItem]] | dict[str, dict[str, str]]]
data value
- data_version = 0
data version, bump this when the format of self.data changes
- directives: dict[str, Type[Directive]] = {'crate': <class 'sphinxcontrib_rust.directives.RustCrateDirective'>, 'enum': <class 'sphinxcontrib_rust.directives.RustEnumDirective'>, 'executable': <class 'sphinxcontrib_rust.directives.RustExecutableDirective'>, 'function': <class 'sphinxcontrib_rust.directives.RustFunctionDirective'>, 'impl': <class 'sphinxcontrib_rust.directives.RustImplDirective'>, 'macro': <class 'sphinxcontrib_rust.directives.RustMacroDirective'>, 'module': <class 'sphinxcontrib_rust.directives.RustModuleDirective'>, 'struct': <class 'sphinxcontrib_rust.directives.RustStructDirective'>, 'trait': <class 'sphinxcontrib_rust.directives.RustTraitDirective'>, 'type': <class 'sphinxcontrib_rust.directives.RustTypeDirective'>, 'use': <class 'sphinxcontrib_rust.directives.RustUseDirective'>, 'variable': <class 'sphinxcontrib_rust.directives.RustVariableDirective'>}
directive name -> directive class
- find_item(fromdocname: str, target: str, typ: str | None = None) RustItem | None
Find a matching item based on a reference target and item type.
This function checks for an item that matches the provided reference target. There are 3 cases for the target, which are checked in order of priority:
The target matches an item name directly.
The target is relative to the current doc and the reference is in the doc where it is defined.
The target is relative to a use directive in the current doc.
Once a check matches an item, the item is returned and other cases are not evaluated.
- Args:
- fromdocname:
The document name in which the reference was found.
- target:
The target for the reference.
- Kwargs:
- typ=None:
The item type to search for. This must be a valid
RustItemTypevalue.
- Returns:
The
RustItemfor the item if found, and None otherwise.
- find_item_by_name(name: str, typ: str | None = None) RustItem | None
Find a matching item based on the name and item type.
This function checks for an item with the provided name. If a type is specified, only items of that type are considered.
- Args:
- name:
The name of the item to find.
- Kwargs:
- typ=None:
The item type to search for. This must be a valid
RustItemTypevalue.
- Returns:
The
RustItemfor the item if found, and None otherwise.
- get_objects() Iterable[tuple[str, str, str, str, str, int]]
Return an iterable of “object descriptions”.
Object descriptions are tuples with six items:
nameFully qualified name.
dispnameName to display when searching/linking.
typeObject type, a key in
self.object_types.docnameThe document where it is to be found.
anchorThe anchor name for the object.
priorityHow “important” the object is (determines placement in search results). One of:
1Default priority (placed before full-text matches).
0Object is important (placed before default-priority objects).
2Object is unimportant (placed after full-text matches).
-1Object should not show up in search at all.
- indices: list[Type[Index]] = [<class 'sphinxcontrib_rust.index.RustIndex'>]
a list of Index subclasses
- initial_data: dict[str, Any] = {'items': {RustItemType.CRATE: [], RustItemType.ENUM: [], RustItemType.EXECUTABLE: [], RustItemType.FUNCTION: [], RustItemType.IMPL: [], RustItemType.MACRO: [], RustItemType.MODULE: [], RustItemType.STRUCT: [], RustItemType.TRAIT: [], RustItemType.TYPE: [], RustItemType.USE: [], RustItemType.VARIABLE: []}, 'uses': {}}
data value for a fresh environment
- property items: dict[RustItemType, list[RustItem]]
Return the Rust items with in the documentation
- label = 'Rust'
domain label: longer, more descriptive (used in messages)
- merge_domaindata(docnames: list[str], otherdata: dict) None
Merge in data regarding docnames from a different domaindata inventory (coming from a subprocess in parallel builds).
- name = 'rust'
domain name: should be short, but unique
- object_types: dict[str, ObjType] = {'crate': <sphinx.domains.ObjType object>, 'enum': <sphinx.domains.ObjType object>, 'executable': <sphinx.domains.ObjType object>, 'function': <sphinx.domains.ObjType object>, 'impl': <sphinx.domains.ObjType object>, 'macro': <sphinx.domains.ObjType object>, 'module': <sphinx.domains.ObjType object>, 'struct': <sphinx.domains.ObjType object>, 'trait': <sphinx.domains.ObjType object>, 'type': <sphinx.domains.ObjType object>, 'use': <sphinx.domains.ObjType object>, 'variable': <sphinx.domains.ObjType object>}
type (usually directive) name -> ObjType instance
- resolve_any_xref(env: BuildEnvironment, fromdocname: str, builder: Builder, target: str, node: pending_xref, contnode: Element) list[tuple[str, Element]]
Resolve a reference to a Rust item with an unspecified directive type
- resolve_xref(env: BuildEnvironment, fromdocname: str, builder: Builder, typ: str, target: str, node: pending_xref, contnode: Element) Element | None
Resolve a reference to a Rust item with the directive type specified
- roles: dict[str, Callable[[str, str, str, int, Inliner, dict[str, Any], Sequence[str]], tuple[list[Node], list[system_message]]] | XRefRole] = {'any': <sphinxcontrib_rust.domain.RustXRefRole object>, 'crate': <sphinxcontrib_rust.domain.RustXRefRole object>, 'enum': <sphinxcontrib_rust.domain.RustXRefRole object>, 'exe': <sphinxcontrib_rust.domain.RustXRefRole object>, 'executable': <sphinxcontrib_rust.domain.RustXRefRole object>, 'fn': <sphinxcontrib_rust.domain.RustXRefRole object>, 'func': <sphinxcontrib_rust.domain.RustXRefRole object>, 'function': <sphinxcontrib_rust.domain.RustXRefRole object>, 'impl': <sphinxcontrib_rust.domain.RustXRefRole object>, 'macro': <sphinxcontrib_rust.domain.RustXRefRole object>, 'module': <sphinxcontrib_rust.domain.RustXRefRole object>, 'struct': <sphinxcontrib_rust.domain.RustXRefRole object>, 'trait': <sphinxcontrib_rust.domain.RustXRefRole object>, 'type': <sphinxcontrib_rust.domain.RustXRefRole object>, 'use': <sphinxcontrib_rust.domain.RustXRefRole object>, 'var': <sphinxcontrib_rust.domain.RustXRefRole object>, 'variable': <sphinxcontrib_rust.domain.RustXRefRole object>}
role name -> role callable
- property uses: dict[str, dict[str, str]]
Return the dict of use statements per document within the documentation
- class sphinxcontrib_rust.domain.RustXRefRole(fix_parens: bool = False, lowercase: bool = False, nodeclass: type[Element] | None = None, innernodeclass: type[TextElement] | None = None, warn_dangling: bool = False)
An
XRefRoleextension for Rust roles- process_link(env: BuildEnvironment, refnode: Element, has_explicit_title: bool, title: str, target: str) tuple[str, str]
Process the link by parsing the title and the target