Skip to content

model Rust

Unified documentation model for Rust and Python items

Structs

struct SourceLocation

pub

Derives: Debug, Clone, Serialize, Deserialize

A reference to a location in source code

Fields

Name Type Description
file PathBuf
line_start usize
line_end usize

Methods

test pub
fn test (file : impl Into < PathBuf > , line_start : usize , line_end : usize) -> Self

Create a test source location

Source
    pub fn test(file: impl Into<PathBuf>, line_start: usize, line_end: usize) -> Self {
        Self {
            file: file.into(),
            line_start,
            line_end,
        }
    }

struct SourceSpan

pub

Derives: Debug, Clone, Serialize, Deserialize

Source code span with the actual text

Fields

Name Type Description
location SourceLocation
source String The actual source code text

Methods

test pub
fn test (file : impl Into < PathBuf > , line_start : usize , line_end : usize) -> Self

Create a test source span with empty source

Source
    pub fn test(file: impl Into<PathBuf>, line_start: usize, line_end: usize) -> Self {
        Self {
            location: SourceLocation::test(file, line_start, line_end),
            source: String::new(),
        }
    }
new pub
fn new (file : impl Into < PathBuf > , line_start : usize , line_end : usize , source : impl Into < String > ,) -> Self

Create a source span with actual source code

Source
    pub fn new(
        file: impl Into<PathBuf>,
        line_start: usize,
        line_end: usize,
        source: impl Into<String>,
    ) -> Self {
        Self {
            location: SourceLocation::test(file, line_start, line_end),
            source: source.into(),
        }
    }

struct RustModule

pub

Derives: Debug, Clone, Serialize, Deserialize

A Rust module with its items

Fields

Name Type Description
path String
doc_comment Option < String >
items Vec < RustItem >
source SourceSpan

Methods

test pub
fn test (path : impl Into < String >) -> Self

Create a test Rust module

Source
    pub fn test(path: impl Into<String>) -> Self {
        Self {
            path: path.into(),
            doc_comment: None,
            items: Vec::new(),
            source: SourceSpan::test("test.rs", 1, 1),
        }
    }
with_doc pub
fn with_doc (mut self , doc : impl Into < String >) -> Self
Source
    pub fn with_doc(mut self, doc: impl Into<String>) -> Self {
        self.doc_comment = Some(doc.into());
        self
    }
with_item pub
fn with_item (mut self , item : RustItem) -> Self
Source
    pub fn with_item(mut self, item: RustItem) -> Self {
        self.items.push(item);
        self
    }
with_source pub
fn with_source (mut self , source : SourceSpan) -> Self
Source
    pub fn with_source(mut self, source: SourceSpan) -> Self {
        self.source = source;
        self
    }

struct RustStruct

pub

Derives: Debug, Clone, Serialize, Deserialize

A Rust struct definition

Fields

Name Type Description
name String
visibility Visibility
doc_comment Option < String >
generics Option < String > Generic parameters as string, e.g. ""
fields Vec < RustField >
derives Vec < String >
pyclass Option < PyClassMeta >
source SourceSpan

Methods

test pub
fn test (name : impl Into < String >) -> Self

Create a test struct

Source
    pub fn test(name: impl Into<String>) -> Self {
        Self {
            name: name.into(),
            visibility: Visibility::Public,
            doc_comment: None,
            generics: None,
            fields: Vec::new(),
            derives: Vec::new(),
            pyclass: None,
            source: SourceSpan::test("test.rs", 1, 1),
        }
    }
with_visibility pub
fn with_visibility (mut self , vis : Visibility) -> Self
Source
    pub fn with_visibility(mut self, vis: Visibility) -> Self {
        self.visibility = vis;
        self
    }
with_doc pub
fn with_doc (mut self , doc : impl Into < String >) -> Self
Source
    pub fn with_doc(mut self, doc: impl Into<String>) -> Self {
        self.doc_comment = Some(doc.into());
        self
    }
with_generics pub
fn with_generics (mut self , generics : impl Into < String >) -> Self
Source
    pub fn with_generics(mut self, generics: impl Into<String>) -> Self {
        self.generics = Some(generics.into());
        self
    }
with_field pub
fn with_field (mut self , field : RustField) -> Self
Source
    pub fn with_field(mut self, field: RustField) -> Self {
        self.fields.push(field);
        self
    }
with_derive pub
fn with_derive (mut self , derive : impl Into < String >) -> Self
Source
    pub fn with_derive(mut self, derive: impl Into<String>) -> Self {
        self.derives.push(derive.into());
        self
    }
with_pyclass pub
fn with_pyclass (mut self , meta : PyClassMeta) -> Self
Source
    pub fn with_pyclass(mut self, meta: PyClassMeta) -> Self {
        self.pyclass = Some(meta);
        self
    }
with_source pub
fn with_source (mut self , source : SourceSpan) -> Self
Source
    pub fn with_source(mut self, source: SourceSpan) -> Self {
        self.source = source;
        self
    }

struct PyClassMeta

pub

Derives: Debug, Clone, Serialize, Deserialize

PyO3 #[pyclass] metadata

Fields

Name Type Description
name Option < String >
module Option < String >

Methods

new pub
fn new () -> Self
Source
    pub fn new() -> Self {
        Self {
            name: None,
            module: None,
        }
    }
with_name pub
fn with_name (mut self , name : impl Into < String >) -> Self
Source
    pub fn with_name(mut self, name: impl Into<String>) -> Self {
        self.name = Some(name.into());
        self
    }
with_module pub
fn with_module (mut self , module : impl Into < String >) -> Self
Source
    pub fn with_module(mut self, module: impl Into<String>) -> Self {
        self.module = Some(module.into());
        self
    }

struct RustField

pub

Derives: Debug, Clone, Serialize, Deserialize

A Rust field

Fields

Name Type Description
name String
ty String
visibility Visibility
doc_comment Option < String >

Methods

test pub
fn test (name : impl Into < String > , ty : impl Into < String >) -> Self

Create a test field

Source
    pub fn test(name: impl Into<String>, ty: impl Into<String>) -> Self {
        Self {
            name: name.into(),
            ty: ty.into(),
            visibility: Visibility::Public,
            doc_comment: None,
        }
    }
private pub
fn private (mut self) -> Self
Source
    pub fn private(mut self) -> Self {
        self.visibility = Visibility::Private;
        self
    }
with_doc pub
fn with_doc (mut self , doc : impl Into < String >) -> Self
Source
    pub fn with_doc(mut self, doc: impl Into<String>) -> Self {
        self.doc_comment = Some(doc.into());
        self
    }

struct RustEnum

pub

Derives: Debug, Clone, Serialize, Deserialize

A Rust enum definition

Fields

Name Type Description
name String
visibility Visibility
doc_comment Option < String >
generics Option < String > Generic parameters as string
variants Vec < RustVariant >
source SourceSpan

struct RustVariant

pub

Derives: Debug, Clone, Serialize, Deserialize

A Rust enum variant

Fields

Name Type Description
name String
doc_comment Option < String >
fields Vec < RustField >

struct RustFunction

pub

Derives: Debug, Clone, Serialize, Deserialize

A Rust function definition

Fields

Name Type Description
name String
visibility Visibility
doc_comment Option < String >
generics Option < String > Generic parameters as string, e.g. "<'a, T: Clone>"
signature_str String Full signature as string for display
signature RustFunctionSig Parsed signature for structured access
is_async bool
is_unsafe bool
is_const bool
pyfunction Option < PyFunctionMeta >
source SourceSpan

Methods

test pub
fn test (name : impl Into < String >) -> Self

Create a test function

Source
    pub fn test(name: impl Into<String>) -> Self {
        let name = name.into();
        Self {
            name: name.clone(),
            visibility: Visibility::Public,
            doc_comment: None,
            generics: None,
            signature_str: format!("fn {}()", name),
            signature: RustFunctionSig {
                params: Vec::new(),
                return_type: None,
            },
            is_async: bool::default(),
            is_unsafe: bool::default(),
            is_const: bool::default(),
            pyfunction: None,
            source: SourceSpan::test("test.rs", 1, 1),
        }
    }
with_doc pub
fn with_doc (mut self , doc : impl Into < String >) -> Self
Source
    pub fn with_doc(mut self, doc: impl Into<String>) -> Self {
        self.doc_comment = Some(doc.into());
        self
    }
with_generics pub
fn with_generics (mut self , generics : impl Into < String >) -> Self
Source
    pub fn with_generics(mut self, generics: impl Into<String>) -> Self {
        self.generics = Some(generics.into());
        self
    }
with_signature pub
fn with_signature (mut self , sig : impl Into < String >) -> Self
Source
    pub fn with_signature(mut self, sig: impl Into<String>) -> Self {
        self.signature_str = sig.into();
        self
    }
with_param pub
fn with_param (mut self , param : RustParam) -> Self
Source
    pub fn with_param(mut self, param: RustParam) -> Self {
        self.signature.params.push(param);
        self
    }
with_return_type pub
fn with_return_type (mut self , ty : impl Into < String >) -> Self
Source
    pub fn with_return_type(mut self, ty: impl Into<String>) -> Self {
        self.signature.return_type = Some(ty.into());
        self
    }
async_ pub
fn async_ (mut self) -> Self
Source
    pub fn async_(mut self) -> Self {
        self.is_async = true;
        self
    }
unsafe_ pub
fn unsafe_ (mut self) -> Self
Source
    pub fn unsafe_(mut self) -> Self {
        self.is_unsafe = true;
        self
    }
const_ pub
fn const_ (mut self) -> Self
Source
    pub fn const_(mut self) -> Self {
        self.is_const = true;
        self
    }
with_pyfunction pub
fn with_pyfunction (mut self , meta : PyFunctionMeta) -> Self
Source
    pub fn with_pyfunction(mut self, meta: PyFunctionMeta) -> Self {
        self.pyfunction = Some(meta);
        self
    }
with_source pub
fn with_source (mut self , source : SourceSpan) -> Self
Source
    pub fn with_source(mut self, source: SourceSpan) -> Self {
        self.source = source;
        self
    }

struct RustFunctionSig

pub

Derives: Debug, Clone, Serialize, Deserialize

Rust function signature

Fields

Name Type Description
params Vec < RustParam >
return_type Option < String >

struct RustParam

pub

Derives: Debug, Clone, Serialize, Deserialize

A Rust function parameter

Fields

Name Type Description
name String
ty String
default Option < String >

Methods

test pub
fn test (name : impl Into < String > , ty : impl Into < String >) -> Self

Create a test parameter

Source
    pub fn test(name: impl Into<String>, ty: impl Into<String>) -> Self {
        Self {
            name: name.into(),
            ty: ty.into(),
            default: None,
        }
    }
with_default pub
fn with_default (mut self , default : impl Into < String >) -> Self
Source
    pub fn with_default(mut self, default: impl Into<String>) -> Self {
        self.default = Some(default.into());
        self
    }

struct PyFunctionMeta

pub

Derives: Debug, Clone, Serialize, Deserialize

PyO3 #[pyfunction] metadata

Fields

Name Type Description
name Option < String >
signature Option < String >

Methods

new pub
fn new () -> Self
Source
    pub fn new() -> Self {
        Self {
            name: None,
            signature: None,
        }
    }
with_name pub
fn with_name (mut self , name : impl Into < String >) -> Self
Source
    pub fn with_name(mut self, name: impl Into<String>) -> Self {
        self.name = Some(name.into());
        self
    }
with_signature pub
fn with_signature (mut self , sig : impl Into < String >) -> Self
Source
    pub fn with_signature(mut self, sig: impl Into<String>) -> Self {
        self.signature = Some(sig.into());
        self
    }

struct RustTrait

pub

Derives: Debug, Clone, Serialize, Deserialize

A Rust trait definition

Fields

Name Type Description
name String
visibility Visibility
doc_comment Option < String >
generics Option < String > Generic parameters as string
bounds Option < String > Supertraits as string, e.g. ": Clone + Send"
associated_types Vec < RustAssociatedType >
methods Vec < RustFunction >
source SourceSpan

struct RustAssociatedType

pub

Derives: Debug, Clone, Serialize, Deserialize

A Rust associated type in a trait

Fields

Name Type Description
name String
doc_comment Option < String >
generics Option < String > Generic parameters (for GATs)
bounds Option < String > Bounds on the associated type

struct RustImpl

pub

Derives: Debug, Clone, Serialize, Deserialize

A Rust impl block

Fields

Name Type Description
generics Option < String > Generic parameters on the impl block
target String The type being implemented for
trait_ Option < String > Trait being implemented (if any)
where_clause Option < String > Where clause constraints
methods Vec < RustFunction >
pymethods bool Whether this is a #[pymethods] block
source SourceSpan

struct RustConst

pub

Derives: Debug, Clone, Serialize, Deserialize

A Rust const item

Fields

Name Type Description
name String
visibility Visibility
doc_comment Option < String >
ty String
value Option < String >
source SourceSpan

struct RustTypeAlias

pub

Derives: Debug, Clone, Serialize, Deserialize

A Rust type alias

Fields

Name Type Description
name String
visibility Visibility
doc_comment Option < String >
generics Option < String >
ty String The aliased type as string
source SourceSpan

struct PythonModule

pub

Derives: Debug, Clone, Serialize, Deserialize

A Python module

Fields

Name Type Description
path String
docstring Option < String >
items Vec < PythonItem >
source_type SourceType
source SourceSpan

Methods

test pub
fn test (path : impl Into < String >) -> Self

Create a test Python module

Source
    pub fn test(path: impl Into<String>) -> Self {
        Self {
            path: path.into(),
            docstring: None,
            items: Vec::new(),
            source_type: SourceType::Python,
            source: SourceSpan::test("test.py", 1, 1),
        }
    }
with_docstring pub
fn with_docstring (mut self , doc : impl Into < String >) -> Self
Source
    pub fn with_docstring(mut self, doc: impl Into<String>) -> Self {
        self.docstring = Some(doc.into());
        self
    }
with_item pub
fn with_item (mut self , item : PythonItem) -> Self
Source
    pub fn with_item(mut self, item: PythonItem) -> Self {
        self.items.push(item);
        self
    }
pyo3_binding pub
fn pyo3_binding (mut self) -> Self
Source
    pub fn pyo3_binding(mut self) -> Self {
        self.source_type = SourceType::PyO3Binding;
        self
    }
with_source pub
fn with_source (mut self , source : SourceSpan) -> Self
Source
    pub fn with_source(mut self, source: SourceSpan) -> Self {
        self.source = source;
        self
    }

struct PythonClass

pub

Derives: Debug, Clone, Serialize, Deserialize

A Python class

Fields

Name Type Description
name String
docstring Option < String >
bases Vec < String >
methods Vec < PythonFunction >
attributes Vec < PythonVariable >
decorators Vec < String >
rust_impl Option < RustItemRef >
source SourceSpan

Methods

test pub
fn test (name : impl Into < String >) -> Self

Create a test Python class

Source
    pub fn test(name: impl Into<String>) -> Self {
        Self {
            name: name.into(),
            docstring: None,
            bases: Vec::new(),
            methods: Vec::new(),
            attributes: Vec::new(),
            decorators: Vec::new(),
            rust_impl: None,
            source: SourceSpan::test("test.py", 1, 1),
        }
    }
with_docstring pub
fn with_docstring (mut self , doc : impl Into < String >) -> Self
Source
    pub fn with_docstring(mut self, doc: impl Into<String>) -> Self {
        self.docstring = Some(doc.into());
        self
    }
with_base pub
fn with_base (mut self , base : impl Into < String >) -> Self
Source
    pub fn with_base(mut self, base: impl Into<String>) -> Self {
        self.bases.push(base.into());
        self
    }
with_method pub
fn with_method (mut self , method : PythonFunction) -> Self
Source
    pub fn with_method(mut self, method: PythonFunction) -> Self {
        self.methods.push(method);
        self
    }
with_attribute pub
fn with_attribute (mut self , attr : PythonVariable) -> Self
Source
    pub fn with_attribute(mut self, attr: PythonVariable) -> Self {
        self.attributes.push(attr);
        self
    }
with_decorator pub
fn with_decorator (mut self , decorator : impl Into < String >) -> Self
Source
    pub fn with_decorator(mut self, decorator: impl Into<String>) -> Self {
        self.decorators.push(decorator.into());
        self
    }
with_rust_impl pub
fn with_rust_impl (mut self , rust_ref : RustItemRef) -> Self
Source
    pub fn with_rust_impl(mut self, rust_ref: RustItemRef) -> Self {
        self.rust_impl = Some(rust_ref);
        self
    }
with_source pub
fn with_source (mut self , source : SourceSpan) -> Self
Source
    pub fn with_source(mut self, source: SourceSpan) -> Self {
        self.source = source;
        self
    }

struct PythonFunction

pub

Derives: Debug, Clone, Serialize, Deserialize

A Python function

Fields

Name Type Description
name String
docstring Option < String >
signature_str String Full signature as string for display
signature PythonFunctionSig Parsed signature for structured access
decorators Vec < String >
is_async bool
is_staticmethod bool
is_classmethod bool
is_property bool
parsed_doc Option < ParsedDocstring >
rust_impl Option < RustItemRef >
source SourceSpan

Methods

test pub
fn test (name : impl Into < String >) -> Self

Create a test Python function

Source
    pub fn test(name: impl Into<String>) -> Self {
        let name = name.into();
        Self {
            name: name.clone(),
            docstring: None,
            signature_str: format!("def {}()", name),
            signature: PythonFunctionSig {
                params: Vec::new(),
                return_type: None,
            },
            decorators: Vec::new(),
            is_async: bool::default(),
            is_staticmethod: bool::default(),
            is_classmethod: bool::default(),
            is_property: bool::default(),
            parsed_doc: None,
            rust_impl: None,
            source: SourceSpan::test("test.py", 1, 1),
        }
    }
with_docstring pub
fn with_docstring (mut self , doc : impl Into < String >) -> Self
Source
    pub fn with_docstring(mut self, doc: impl Into<String>) -> Self {
        self.docstring = Some(doc.into());
        self
    }
with_signature pub
fn with_signature (mut self , sig : impl Into < String >) -> Self
Source
    pub fn with_signature(mut self, sig: impl Into<String>) -> Self {
        self.signature_str = sig.into();
        self
    }
with_param pub
fn with_param (mut self , param : PythonParam) -> Self
Source
    pub fn with_param(mut self, param: PythonParam) -> Self {
        self.signature.params.push(param);
        self
    }
with_return_type pub
fn with_return_type (mut self , ty : impl Into < String >) -> Self
Source
    pub fn with_return_type(mut self, ty: impl Into<String>) -> Self {
        self.signature.return_type = Some(ty.into());
        self
    }
with_decorator pub
fn with_decorator (mut self , decorator : impl Into < String >) -> Self
Source
    pub fn with_decorator(mut self, decorator: impl Into<String>) -> Self {
        self.decorators.push(decorator.into());
        self
    }
async_ pub
fn async_ (mut self) -> Self
Source
    pub fn async_(mut self) -> Self {
        self.is_async = true;
        self
    }
staticmethod pub
fn staticmethod (mut self) -> Self
Source
    pub fn staticmethod(mut self) -> Self {
        self.is_staticmethod = true;
        self
    }
classmethod pub
fn classmethod (mut self) -> Self
Source
    pub fn classmethod(mut self) -> Self {
        self.is_classmethod = true;
        self
    }
property pub
fn property (mut self) -> Self
Source
    pub fn property(mut self) -> Self {
        self.is_property = true;
        self
    }
with_rust_impl pub
fn with_rust_impl (mut self , rust_ref : RustItemRef) -> Self
Source
    pub fn with_rust_impl(mut self, rust_ref: RustItemRef) -> Self {
        self.rust_impl = Some(rust_ref);
        self
    }
with_source pub
fn with_source (mut self , source : SourceSpan) -> Self
Source
    pub fn with_source(mut self, source: SourceSpan) -> Self {
        self.source = source;
        self
    }

struct PythonFunctionSig

pub

Derives: Debug, Clone, Serialize, Deserialize

Python function signature

Fields

Name Type Description
params Vec < PythonParam >
return_type Option < String >

struct PythonParam

pub

Derives: Debug, Clone, Serialize, Deserialize

A Python function parameter

Fields

Name Type Description
name String
ty Option < String >
default Option < String >

Methods

test pub
fn test (name : impl Into < String >) -> Self

Create a test parameter

Source
    pub fn test(name: impl Into<String>) -> Self {
        Self {
            name: name.into(),
            ty: None,
            default: None,
        }
    }
with_type pub
fn with_type (mut self , ty : impl Into < String >) -> Self
Source
    pub fn with_type(mut self, ty: impl Into<String>) -> Self {
        self.ty = Some(ty.into());
        self
    }
with_default pub
fn with_default (mut self , default : impl Into < String >) -> Self
Source
    pub fn with_default(mut self, default: impl Into<String>) -> Self {
        self.default = Some(default.into());
        self
    }

struct PythonVariable

pub

Derives: Debug, Clone, Serialize, Deserialize

A Python variable/attribute

Fields

Name Type Description
name String
ty Option < String >
value Option < String >
docstring Option < String >

Methods

test pub
fn test (name : impl Into < String >) -> Self

Create a test variable

Source
    pub fn test(name: impl Into<String>) -> Self {
        Self {
            name: name.into(),
            ty: None,
            value: None,
            docstring: None,
        }
    }
with_type pub
fn with_type (mut self , ty : impl Into < String >) -> Self
Source
    pub fn with_type(mut self, ty: impl Into<String>) -> Self {
        self.ty = Some(ty.into());
        self
    }
with_value pub
fn with_value (mut self , value : impl Into < String >) -> Self
Source
    pub fn with_value(mut self, value: impl Into<String>) -> Self {
        self.value = Some(value.into());
        self
    }
with_docstring pub
fn with_docstring (mut self , doc : impl Into < String >) -> Self
Source
    pub fn with_docstring(mut self, doc: impl Into<String>) -> Self {
        self.docstring = Some(doc.into());
        self
    }

struct ParsedDocstring

pub

Derives: Debug, Clone, Serialize, Deserialize

Parsed docstring (Google/NumPy style)

Fields

Name Type Description
summary Option < String >
description Option < String >
params Vec < ParamDoc >
returns Option < ReturnDoc >
raises Vec < RaisesDoc >
examples Vec < String >

struct ParamDoc

pub

Derives: Debug, Clone, Serialize, Deserialize

Documented parameter

Fields

Name Type Description
name String
ty Option < String >
description String

struct ReturnDoc

pub

Derives: Debug, Clone, Serialize, Deserialize

Documented return value

Fields

Name Type Description
ty Option < String >
description String

struct RaisesDoc

pub

Derives: Debug, Clone, Serialize, Deserialize

Documented exception

Fields

Name Type Description
ty String
description String

struct RustItemRef

pub

Derives: Debug, Clone, Serialize, Deserialize

Reference to a Rust item

Fields

Name Type Description
path String
name String

Methods

new pub
fn new (path : impl Into < String > , name : impl Into < String >) -> Self
Source
    pub fn new(path: impl Into<String>, name: impl Into<String>) -> Self {
        Self {
            path: path.into(),
            name: name.into(),
        }
    }

struct CrossRef

pub

Derives: Debug, Clone, Serialize, Deserialize

Cross-reference between Python and Rust

Fields

Name Type Description
python_path String
rust_path String
relationship CrossRefKind

Methods

binding pub
fn binding (python_path : impl Into < String > , rust_path : impl Into < String >) -> Self
Source
    pub fn binding(python_path: impl Into<String>, rust_path: impl Into<String>) -> Self {
        Self {
            python_path: python_path.into(),
            rust_path: rust_path.into(),
            relationship: CrossRefKind::Binding,
        }
    }
wraps pub
fn wraps (python_path : impl Into < String > , rust_path : impl Into < String >) -> Self
Source
    pub fn wraps(python_path: impl Into<String>, rust_path: impl Into<String>) -> Self {
        Self {
            python_path: python_path.into(),
            rust_path: rust_path.into(),
            relationship: CrossRefKind::Wraps,
        }
    }
delegates pub
fn delegates (python_path : impl Into < String > , rust_path : impl Into < String >) -> Self
Source
    pub fn delegates(python_path: impl Into<String>, rust_path: impl Into<String>) -> Self {
        Self {
            python_path: python_path.into(),
            rust_path: rust_path.into(),
            relationship: CrossRefKind::Delegates,
        }
    }

struct DocModel

pub

Derives: Debug, Clone, Serialize, Deserialize

The complete documentation model for a project

Fields

Name Type Description
metadata ProjectMetadata
rust_modules Vec < RustModule >
python_modules Vec < PythonModule >
cross_refs Vec < CrossRef >

Methods

test pub
fn test (name : impl Into < String >) -> Self

Create an empty doc model for testing

Source
    pub fn test(name: impl Into<String>) -> Self {
        Self {
            metadata: ProjectMetadata::test(name),
            rust_modules: Vec::new(),
            python_modules: Vec::new(),
            cross_refs: Vec::new(),
        }
    }
with_rust_module pub
fn with_rust_module (mut self , module : RustModule) -> Self
Source
    pub fn with_rust_module(mut self, module: RustModule) -> Self {
        self.rust_modules.push(module);
        self
    }
with_python_module pub
fn with_python_module (mut self , module : PythonModule) -> Self
Source
    pub fn with_python_module(mut self, module: PythonModule) -> Self {
        self.python_modules.push(module);
        self
    }
with_cross_ref pub
fn with_cross_ref (mut self , cross_ref : CrossRef) -> Self
Source
    pub fn with_cross_ref(mut self, cross_ref: CrossRef) -> Self {
        self.cross_refs.push(cross_ref);
        self
    }

struct ProjectMetadata

pub

Derives: Debug, Clone, Serialize, Deserialize

Project metadata

Fields

Name Type Description
name String Project name
version Option < String > Project version (from Cargo.toml or pyproject.toml)
description Option < String > Project description
git_ref Option < String > Git ref (branch or tag) this was generated from
git_commit Option < String > Git commit hash
generated_at String When the documentation was generated

Methods

test pub
fn test (name : impl Into < String >) -> Self

Create test metadata

Source
    pub fn test(name: impl Into<String>) -> Self {
        Self {
            name: name.into(),
            version: None,
            description: None,
            git_ref: None,
            git_commit: None,
            generated_at: "2024-01-01T00:00:00Z".to_string(),
        }
    }
with_version pub
fn with_version (mut self , version : impl Into < String >) -> Self
Source
    pub fn with_version(mut self, version: impl Into<String>) -> Self {
        self.version = Some(version.into());
        self
    }
with_description pub
fn with_description (mut self , desc : impl Into < String >) -> Self
Source
    pub fn with_description(mut self, desc: impl Into<String>) -> Self {
        self.description = Some(desc.into());
        self
    }
with_git_ref pub
fn with_git_ref (mut self , git_ref : impl Into < String >) -> Self
Source
    pub fn with_git_ref(mut self, git_ref: impl Into<String>) -> Self {
        self.git_ref = Some(git_ref.into());
        self
    }
with_git_commit pub
fn with_git_commit (mut self , commit : impl Into < String >) -> Self
Source
    pub fn with_git_commit(mut self, commit: impl Into<String>) -> Self {
        self.git_commit = Some(commit.into());
        self
    }

Enums

enum SourceType pub

Source type indicator for Python modules

Variants

  • Python - Pure Python source code
  • PyO3Binding - Rust code exposed via PyO3
  • Rust - Pure Rust (no Python exposure)

enum Visibility pub

Visibility level for Rust items

Variants

  • Public
  • PubCrate
  • PubSuper
  • Private

enum RustItem pub

A Rust item (struct, enum, function, etc.)

Variants

  • Struct
  • Enum
  • Function
  • Trait
  • Impl
  • Const
  • TypeAlias

enum PythonItem pub

A Python item

Variants

  • Class
  • Function
  • Variable

enum CrossRefKind pub

Kind of cross-reference

Variants

  • Binding - Direct PyO3 binding
  • Wraps - Python wraps Rust
  • Delegates - Python delegates to Rust