Skip to content

plissken-core::model

Rust

Unified documentation model for Rust and Python items

pub

Derives: Debug, Clone, Serialize, Deserialize

A reference to a location in source code

Name Type Description
file PathBuf
line_start usize
line_end usize

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,
}
}

pub

Derives: Debug, Clone, Serialize, Deserialize

Source code span with the actual text

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

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(),
}
}

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(),
}
}

pub

Derives: Debug, Clone, Serialize, Deserialize

A Rust module with its items

Name Type Description
path String
doc_comment Option<String>
parsed_doc Option<ParsedDocstring>
items Vec<RustItem>
reexports Vec<RustReexport> The pub use declarations of the module
test_modules Vec<String> Names of the submodules declared #[cfg(test)] mod name;
py_registrars Vec<PyModuleRegistrar> The functions that build PyO3 modules (#[pymodule], and helpers that get the module as a parameter)
source SourceSpan

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,
parsed_doc: None,
items: Vec::new(),
reexports: Vec::new(),
test_modules: Vec::new(),
py_registrars: Vec::new(),
source: SourceSpan::test("test.rs", 1, 1),
}
}

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
}

pub

fn with_item(mut self, item: RustItem) -> Self
Source
pub fn with_item(mut self, item: RustItem) -> Self {
self.items.push(item);
self
}

pub

fn with_source(mut self, source: SourceSpan) -> Self
Source
pub fn with_source(mut self, source: SourceSpan) -> Self {
self.source = source;
self
}

pub

Derives: Debug, Clone, Serialize, Deserialize, PartialEq

A function that adds items to a PyO3 module: a #[pymodule] function, or a helper that gets the module as a parameter (register(m)).

Name Type Description
function String The Rust name of the function
pymodule Option<String> The Python name of the module, if the function is a #[pymodule]
doc_comment Option<String>
adds Vec<PyModuleAdd> What the function adds, in order

pub

Derives: Debug, Clone, Serialize, Deserialize, PartialEq

One thing that a PyModuleRegistrar adds to a module.

Name Type Description
module String The module it adds to: empty for the module of the parameter, else the Python name of a submodule made in the function
kind PyModuleAddKind
path String The Rust path of the class or function; the Python name of the submodule; the name of the function called

pub

Derives: Debug, Clone, Serialize, Deserialize, PartialEq

A name that a module re-exports: pub use crate::context::Context;

Name Type Description
name String The name in the module (Context, or * for a glob)
path String The path that is re-exported (crate::context::Context, or crate::context for a glob)
visibility Visibility
doc_comment Option<String>

pub

Derives: Debug, Clone, Serialize, Deserialize

A Rust struct definition

Name Type Description
name String
visibility Visibility
doc_comment Option<String>
parsed_doc Option<ParsedDocstring>
generics Option<String> Generic parameters as string, e.g. “<T: Clone, const N: usize>”
fields Vec<RustField>
derives Vec<String>
pyclass Option<PyClassMeta>
source SourceSpan

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,
parsed_doc: None,
generics: None,
fields: Vec::new(),
derives: Vec::new(),
pyclass: None,
source: SourceSpan::test("test.rs", 1, 1),
}
}

pub

fn with_visibility(mut self, vis: Visibility) -> Self
Source
pub fn with_visibility(mut self, vis: Visibility) -> Self {
self.visibility = vis;
self
}

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
}

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
}

pub

fn with_field(mut self, field: RustField) -> Self
Source
pub fn with_field(mut self, field: RustField) -> Self {
self.fields.push(field);
self
}

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
}

pub

fn with_pyclass(mut self, meta: PyClassMeta) -> Self
Source
pub fn with_pyclass(mut self, meta: PyClassMeta) -> Self {
self.pyclass = Some(meta);
self
}

pub

fn with_source(mut self, source: SourceSpan) -> Self
Source
pub fn with_source(mut self, source: SourceSpan) -> Self {
self.source = source;
self
}

pub

Derives: Debug, Clone, Serialize, Deserialize

PyO3 #[pyclass] metadata

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

pub

fn new() -> Self
Source
pub fn new() -> Self {
Self {
name: None,
module: None,
}
}

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
}

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
}

pub

Derives: Debug, Clone, Serialize, Deserialize

A Rust field

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

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,
}
}

pub

fn private(mut self) -> Self
Source
pub fn private(mut self) -> Self {
self.visibility = Visibility::Private;
self
}

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
}

pub

Derives: Debug, Clone, Serialize, Deserialize

A Rust enum definition

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

pub

Derives: Debug, Clone, Serialize, Deserialize

A Rust enum variant

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

pub

Derives: Debug, Clone, Serialize, Deserialize

A Rust function definition

Name Type Description
name String
visibility Visibility
doc_comment Option<String>
parsed_doc Option<ParsedDocstring>
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

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,
parsed_doc: 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),
}
}

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
}

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
}

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
}

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
}

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
}

pub

fn async_(mut self) -> Self
Source
pub fn async_(mut self) -> Self {
self.is_async = true;
self
}

pub

fn unsafe_(mut self) -> Self
Source
pub fn unsafe_(mut self) -> Self {
self.is_unsafe = true;
self
}

pub

fn const_(mut self) -> Self
Source
pub fn const_(mut self) -> Self {
self.is_const = true;
self
}

pub

fn with_pyfunction(mut self, meta: PyFunctionMeta) -> Self
Source
pub fn with_pyfunction(mut self, meta: PyFunctionMeta) -> Self {
self.pyfunction = Some(meta);
self
}

pub

fn with_source(mut self, source: SourceSpan) -> Self
Source
pub fn with_source(mut self, source: SourceSpan) -> Self {
self.source = source;
self
}

pub

Derives: Debug, Clone, Serialize, Deserialize

Rust function signature

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

pub

Derives: Debug, Clone, Serialize, Deserialize

A Rust function parameter

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

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,
}
}

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
}

pub

Derives: Debug, Clone, Serialize, Deserialize

PyO3 #[pyfunction] metadata

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

pub

fn new() -> Self
Source
pub fn new() -> Self {
Self {
name: None,
signature: None,
}
}

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
}

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
}

pub

Derives: Debug, Clone, Serialize, Deserialize

A Rust trait definition

Name Type Description
name String
visibility Visibility
doc_comment Option<String>
parsed_doc Option<ParsedDocstring>
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

pub

Derives: Debug, Clone, Serialize, Deserialize

A Rust associated type in a trait

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

pub

Derives: Debug, Clone, Serialize, Deserialize

A Rust impl block

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

pub

Derives: Debug, Clone, Serialize, Deserialize

A Rust const item

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

pub

Derives: Debug, Clone, Serialize, Deserialize

A Rust type alias

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

pub

Derives: Debug, Clone, Serialize, Deserialize

A Python module

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

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,
parsed_doc: None,
items: Vec::new(),
source_type: SourceType::Python,
source: SourceSpan::test("test.py", 1, 1),
}
}

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
}

pub

fn with_item(mut self, item: PythonItem) -> Self
Source
pub fn with_item(mut self, item: PythonItem) -> Self {
self.items.push(item);
self
}

pub

fn pyo3_binding(mut self) -> Self
Source
pub fn pyo3_binding(mut self) -> Self {
self.source_type = SourceType::PyO3Binding;
self
}

pub

fn with_source(mut self, source: SourceSpan) -> Self
Source
pub fn with_source(mut self, source: SourceSpan) -> Self {
self.source = source;
self
}

pub

Derives: Debug, Clone, Serialize, Deserialize

A Python class

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

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,
parsed_doc: None,
bases: Vec::new(),
methods: Vec::new(),
attributes: Vec::new(),
decorators: Vec::new(),
rust_impl: None,
source: SourceSpan::test("test.py", 1, 1),
}
}

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
}

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
}

pub

fn with_method(mut self, method: PythonFunction) -> Self
Source
pub fn with_method(mut self, method: PythonFunction) -> Self {
self.methods.push(method);
self
}

pub

fn with_attribute(mut self, attr: PythonVariable) -> Self
Source
pub fn with_attribute(mut self, attr: PythonVariable) -> Self {
self.attributes.push(attr);
self
}

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
}

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
}

pub

fn with_source(mut self, source: SourceSpan) -> Self
Source
pub fn with_source(mut self, source: SourceSpan) -> Self {
self.source = source;
self
}

pub

Derives: Debug, Clone, Serialize, Deserialize

A Python function

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

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),
}
}

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
}

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
}

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
}

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
}

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
}

pub

fn async_(mut self) -> Self
Source
pub fn async_(mut self) -> Self {
self.is_async = true;
self
}

pub

fn staticmethod(mut self) -> Self
Source
pub fn staticmethod(mut self) -> Self {
self.is_staticmethod = true;
self
}

pub

fn classmethod(mut self) -> Self
Source
pub fn classmethod(mut self) -> Self {
self.is_classmethod = true;
self
}

pub

fn property(mut self) -> Self
Source
pub fn property(mut self) -> Self {
self.is_property = true;
self
}

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
}

pub

fn with_source(mut self, source: SourceSpan) -> Self
Source
pub fn with_source(mut self, source: SourceSpan) -> Self {
self.source = source;
self
}

pub

Derives: Debug, Clone, Serialize, Deserialize

Python function signature

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

pub

Derives: Debug, Clone, Serialize, Deserialize

A Python function parameter

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

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,
}
}

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
}

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
}

pub

Derives: Debug, Clone, Serialize, Deserialize

A Python variable/attribute

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

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,
}
}

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
}

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
}

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
}

pub

Derives: Debug, Clone, Serialize, Deserialize

Parsed docstring (Google/NumPy style)

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

pub

Derives: Debug, Clone, Serialize, Deserialize

Documented parameter

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

pub

Derives: Debug, Clone, Serialize, Deserialize

Documented return value

Name Type Description
ty Option<String>
description String

pub

Derives: Debug, Clone, Serialize, Deserialize

Documented exception

Name Type Description
ty String
description String

pub

Derives: Debug, Clone, Serialize, Deserialize

Reference to a Rust item

Name Type Description
path String
name String

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(),
}
}

pub

Derives: Debug, Clone, Serialize, Deserialize

Cross-reference between Python and Rust

Name Type Description
python_path String
rust_path String
relationship CrossRefKind

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,
}
}

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,
}
}

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,
}
}

pub

Derives: Debug, Clone, Serialize, Deserialize

The complete documentation model for a project

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

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(),
}
}

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
}

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
}

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
}

pub

Derives: Debug, Clone, Serialize, Deserialize

Project metadata

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

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(),
}
}

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
}

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
}

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
}

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
}

pub

Source type indicator for Python modules

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

pub

Visibility level for Rust items

  • Public
  • PubCrate
  • PubSuper
  • Private

pub

What a PyModuleAdd adds.

  • Class - m.add_class::<Type>()
  • Function - m.add_function(wrap_pyfunction!(f, m)?)
  • Submodule - m.add_submodule(&sub)
  • Call - helper(m): the helper adds to the module
  • Pymodule - m.add_submodule(wrap_pymodule!(f)): the #[pymodule] function f (the path) is a submodule

pub

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

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

pub

A Python item

  • Class
  • Function
  • Variable

pub

Kind of cross-reference

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