sphinxcontrib_rust.domain

The module defines the RustDomain class, which is a Sphinx domain for the various concepts used within the Rust programming language.

Classes

RustDomain(env)

The Sphinx domain for the Rust programming language.

RustXRefRole([fix_parens, lowercase, ...])

An XRefRole extension for Rust roles

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[RustItemType, list[RustItem]]

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'>, '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'>, 'variable': <class 'sphinxcontrib_rust.directives.RustVariableDirective'>}

directive name -> directive class

get_objects() Iterable[tuple[str, str, str, str, str, int]]

Return an iterable of “object descriptions”.

Object descriptions are tuples with six items:

name

Fully qualified name.

dispname

Name to display when searching/linking.

type

Object type, a key in self.object_types.

docname

The document where it is to be found.

anchor

The anchor name for the object.

priority

How “important” the object is (determines placement in search results). One of:

1

Default priority (placed before full-text matches).

0

Object is important (placed before default-priority objects).

2

Object is unimportant (placed after full-text matches).

-1

Object should not show up in search at all.

indices: list[Type[Index]] = [<class 'sphinxcontrib_rust.index.CrateIndex'>, <class 'sphinxcontrib_rust.index.ModuleIndex'>, <class 'sphinxcontrib_rust.index.StructIndex'>, <class 'sphinxcontrib_rust.index.TraitIndex'>, <class 'sphinxcontrib_rust.index.EnumIndex'>, <class 'sphinxcontrib_rust.index.FunctionIndex'>, <class 'sphinxcontrib_rust.index.VariableIndex'>, <class 'sphinxcontrib_rust.index.TypeIndex'>]

a list of Index subclasses

initial_data: dict[RustItemType, list[RustItem]] = {RustItemType.CRATE: [], RustItemType.ENUM: [], RustItemType.FUNCTION: [], RustItemType.IMPL: [], RustItemType.MACRO: [], RustItemType.MODULE: [], RustItemType.STRUCT: [], RustItemType.TRAIT: [], RustItemType.TYPE: [], RustItemType.VARIABLE: []}

data value for a fresh environment

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>, '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>, '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] = {'crate': <sphinxcontrib_rust.domain.RustXRefRole object>, 'enum': <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>, 'var': <sphinxcontrib_rust.domain.RustXRefRole object>, 'variable': <sphinxcontrib_rust.domain.RustXRefRole object>}

role name -> role callable

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 XRefRole extension for Rust roles

Process the link by parsing the tile and the target