sphinxcontrib_rust.items

Module for Rust items and related utility classes

Classes

RustItem(name, display_text, type_, docname)

A dataclass for holding the details of a Sphinx object for Rust domain

RustItemType(*values)

Enum of the various Rust items that are supported by the directives

SphinxIndexEntryType(*values)

Various index types implemented by Sphinx.

class sphinxcontrib_rust.items.RustItem(name: str, display_text: str, type_: RustItemType, docname: str, qualifier: str = '', anchor: str = '', priority: int = 0, index_entry_type: SphinxIndexEntryType = SphinxIndexEntryType.NORMAL, index_text: str = '', index_descr: str = '', reexport_of: str = '')

A dataclass for holding the details of a Sphinx object for Rust domain

Attributes:
name:

The name of the object.

dispname:

The name of the object used in directives and references.

type_:

The object type.

docname:

The document the object is defined in. This is the generated reStructured Text document, not the source code.

qualifier:

Qualifier for the description.

anchor:

Anchor for the entry within the docname.

priority:

The search priority for the object.

entry_type:

The Sphinx index entry type for the object.

reexport_of:

If the type_ is RustItemType.USE, the reexport_of field is the name of the item that was re-exported.

make_index_entry() IndexEntry

Make the Sphinx index entry for the item

class sphinxcontrib_rust.items.RustItemType(*values)

Enum of the various Rust items that are supported by the directives

Each item type is associated with a directive. The enum provides methods for the role names, index section name, etc. that are used in the output and also methods for interacting with Sphinx.

static disambiguated_target(target: str, default_type: str | None = None) tuple[str, str]

Disambiguate the target’s type from the target

Args:
target:

The link target to disambiguate.

default_type:

The default type to return when there are no disambiguators.

Returns:

A tuple of the new target and the disambiguated type. This is the same as the input arguments when there are no disambiguators present.

property display_text: str

Return the string to display for the item type.

Returns fn for the FUNCTION item type and the value for all other item types.

classmethod from_str(value: str) RustItemType

Get the enum corresponding to the string value

get_roles() Sequence[str]

Get the Sphinx roles that can reference the object type

get_sphinx_obj_type() ObjType

Get the Sphinx ObjType instance for the object type

property index_section_name: str

Return the index section name for the item type

static iter_roles() Iterator[tuple[RustItemType, str]]

Iterate over (type, role) tuples across all types

class sphinxcontrib_rust.items.SphinxIndexEntryType(*values)

Various index types implemented by Sphinx.

The corresponding Rust enum is sphinx_rustdocgen::directives::IndexEntryType.

See Also:

https://www.sphinx-doc.org/en/master/extdev/domainapi.html#sphinx.domains.Index.generate