diff --git a/python/sphinx_rust/directives/crate.py b/python/sphinx_rust/directives/crate.py index 96ec90c..1d4d163 100644 --- a/python/sphinx_rust/directives/crate.py +++ b/python/sphinx_rust/directives/crate.py @@ -67,6 +67,7 @@ def run(self) -> list[nodes.Node]: root += nodes.paragraph("", f"Version: {crate.version}") desc = addnodes.desc() + desc["objtype"] = f"{self.rust_domain.name}:crate" root += desc signature = addnodes.desc_signature(crate.name, f"pub mod {crate.name};") desc += signature diff --git a/python/sphinx_rust/directives/enum.py b/python/sphinx_rust/directives/enum.py index 7930f3d..2cd5b0f 100644 --- a/python/sphinx_rust/directives/enum.py +++ b/python/sphinx_rust/directives/enum.py @@ -49,6 +49,7 @@ def run(self) -> list[nodes.Node]: desc = addnodes.desc() root += desc if enum.variants: + desc["objtype"] = f"{self.rust_domain.name}:struct" sig_lines = [addnodes.desc_signature_line("", f"pub struct {enum.name} {{")] for var in enum.variants: # TODO types @@ -61,6 +62,7 @@ def run(self) -> list[nodes.Node]: signature = addnodes.desc_signature(enum.path_str, "", *sig_lines) signature["is_multiline"] = True else: + desc["objtype"] = f"{self.rust_domain.name}:enum" signature = addnodes.desc_signature( enum.path_str, f"pub enum {enum.name} {{}}" ) diff --git a/python/sphinx_rust/directives/function.py b/python/sphinx_rust/directives/function.py index 43de8d2..83b6761 100644 --- a/python/sphinx_rust/directives/function.py +++ b/python/sphinx_rust/directives/function.py @@ -46,6 +46,7 @@ def run(self) -> list[nodes.Node]: root = nodes.Element() desc = addnodes.desc() + desc["objtype"] = f"{self.rust_domain.name}:function" root += desc signature = addnodes.desc_signature( func.path_str, diff --git a/python/sphinx_rust/directives/module.py b/python/sphinx_rust/directives/module.py index 5d0cebc..2c7990a 100644 --- a/python/sphinx_rust/directives/module.py +++ b/python/sphinx_rust/directives/module.py @@ -61,6 +61,9 @@ def run(self) -> list[nodes.Node]: root = nodes.Element() desc = addnodes.desc() + + desc["objtype"] = f"{self.rust_domain.name}:module" + root += desc signature = addnodes.desc_signature(module.path_str, f"pub mod {module.name};") desc += signature diff --git a/python/sphinx_rust/directives/struct.py b/python/sphinx_rust/directives/struct.py index 686215b..2177c07 100644 --- a/python/sphinx_rust/directives/struct.py +++ b/python/sphinx_rust/directives/struct.py @@ -48,6 +48,7 @@ def run(self) -> list[nodes.Node]: root = nodes.Element() desc = addnodes.desc() + desc["objtype"] = f"{self.rust_domain.name}:struct" root += desc if struct.fields: sig_lines = [