plissken-core::model
Rust
Unified documentation model for Rust and Python items
Structs
Section titled “Structs”struct SourceLocation
Section titled “struct SourceLocation”pub
Derives: Debug, Clone, Serialize, Deserialize
A reference to a location in source code
Fields
Section titled “Fields”| Name | Type | Description |
|---|---|---|
file |
PathBuf |
|
line_start |
usize |
|
line_end |
usize |
Methods
Section titled “Methods”pub
fn test( file: impl Into<PathBuf>, line_start: usize, line_end: usize,) -> SelfCreate 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
Section titled “struct SourceSpan”pub
Derives: Debug, Clone, Serialize, Deserialize
Source code span with the actual text
Fields
Section titled “Fields”| Name | Type | Description |
|---|---|---|
location |
SourceLocation |
|
source |
String |
The actual source code text |
Methods
Section titled “Methods”pub
fn test( file: impl Into<PathBuf>, line_start: usize, line_end: usize,) -> SelfCreate 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>,) -> SelfCreate 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
Section titled “struct RustModule”pub
Derives: Debug, Clone, Serialize, Deserialize
A Rust module with its items
Fields
Section titled “Fields”| 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 |
Methods
Section titled “Methods”pub
fn test(path: impl Into<String>) -> SelfCreate 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), } }with_doc
Section titled “with_doc”pub
fn with_doc(mut self, doc: impl Into<String>) -> SelfSource
pub fn with_doc(mut self, doc: impl Into<String>) -> Self { self.doc_comment = Some(doc.into()); self }with_item
Section titled “with_item”pub
fn with_item(mut self, item: RustItem) -> SelfSource
pub fn with_item(mut self, item: RustItem) -> Self { self.items.push(item); self }with_source
Section titled “with_source”pub
fn with_source(mut self, source: SourceSpan) -> SelfSource
pub fn with_source(mut self, source: SourceSpan) -> Self { self.source = source; self }struct PyModuleRegistrar
Section titled “struct PyModuleRegistrar”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)).
Fields
Section titled “Fields”| 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 |
struct PyModuleAdd
Section titled “struct PyModuleAdd”pub
Derives: Debug, Clone, Serialize, Deserialize, PartialEq
One thing that a PyModuleRegistrar adds to a module.
Fields
Section titled “Fields”| 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 |
struct RustReexport
Section titled “struct RustReexport”pub
Derives: Debug, Clone, Serialize, Deserialize, PartialEq
A name that a module re-exports: pub use crate::context::Context;
Fields
Section titled “Fields”| 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> |
struct RustStruct
Section titled “struct RustStruct”pub
Derives: Debug, Clone, Serialize, Deserialize
A Rust struct definition
Fields
Section titled “Fields”| 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 |
Methods
Section titled “Methods”pub
fn test(name: impl Into<String>) -> SelfCreate 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), } }with_visibility
Section titled “with_visibility”pub
fn with_visibility(mut self, vis: Visibility) -> SelfSource
pub fn with_visibility(mut self, vis: Visibility) -> Self { self.visibility = vis; self }with_doc
Section titled “with_doc”pub
fn with_doc(mut self, doc: impl Into<String>) -> SelfSource
pub fn with_doc(mut self, doc: impl Into<String>) -> Self { self.doc_comment = Some(doc.into()); self }with_generics
Section titled “with_generics”pub
fn with_generics(mut self, generics: impl Into<String>) -> SelfSource
pub fn with_generics(mut self, generics: impl Into<String>) -> Self { self.generics = Some(generics.into()); self }with_field
Section titled “with_field”pub
fn with_field(mut self, field: RustField) -> SelfSource
pub fn with_field(mut self, field: RustField) -> Self { self.fields.push(field); self }with_derive
Section titled “with_derive”pub
fn with_derive(mut self, derive: impl Into<String>) -> SelfSource
pub fn with_derive(mut self, derive: impl Into<String>) -> Self { self.derives.push(derive.into()); self }with_pyclass
Section titled “with_pyclass”pub
fn with_pyclass(mut self, meta: PyClassMeta) -> SelfSource
pub fn with_pyclass(mut self, meta: PyClassMeta) -> Self { self.pyclass = Some(meta); self }with_source
Section titled “with_source”pub
fn with_source(mut self, source: SourceSpan) -> SelfSource
pub fn with_source(mut self, source: SourceSpan) -> Self { self.source = source; self }struct PyClassMeta
Section titled “struct PyClassMeta”pub
Derives: Debug, Clone, Serialize, Deserialize
PyO3 #[pyclass] metadata
Fields
Section titled “Fields”| Name | Type | Description |
|---|---|---|
name |
Option<String> |
|
module |
Option<String> |
Methods
Section titled “Methods”pub
fn new() -> SelfSource
pub fn new() -> Self { Self { name: None, module: None, } }with_name
Section titled “with_name”pub
fn with_name(mut self, name: impl Into<String>) -> SelfSource
pub fn with_name(mut self, name: impl Into<String>) -> Self { self.name = Some(name.into()); self }with_module
Section titled “with_module”pub
fn with_module(mut self, module: impl Into<String>) -> SelfSource
pub fn with_module(mut self, module: impl Into<String>) -> Self { self.module = Some(module.into()); self }struct RustField
Section titled “struct RustField”pub
Derives: Debug, Clone, Serialize, Deserialize
A Rust field
Fields
Section titled “Fields”| Name | Type | Description |
|---|---|---|
name |
String |
|
ty |
String |
|
visibility |
Visibility |
|
doc_comment |
Option<String> |
Methods
Section titled “Methods”pub
fn test(name: impl Into<String>, ty: impl Into<String>) -> SelfCreate 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
Section titled “private”pub
fn private(mut self) -> SelfSource
pub fn private(mut self) -> Self { self.visibility = Visibility::Private; self }with_doc
Section titled “with_doc”pub
fn with_doc(mut self, doc: impl Into<String>) -> SelfSource
pub fn with_doc(mut self, doc: impl Into<String>) -> Self { self.doc_comment = Some(doc.into()); self }struct RustEnum
Section titled “struct RustEnum”pub
Derives: Debug, Clone, Serialize, Deserialize
A Rust enum definition
Fields
Section titled “Fields”| 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 |
struct RustVariant
Section titled “struct RustVariant”pub
Derives: Debug, Clone, Serialize, Deserialize
A Rust enum variant
Fields
Section titled “Fields”| Name | Type | Description |
|---|---|---|
name |
String |
|
doc_comment |
Option<String> |
|
fields |
Vec<RustField> |
struct RustFunction
Section titled “struct RustFunction”pub
Derives: Debug, Clone, Serialize, Deserialize
A Rust function definition
Fields
Section titled “Fields”| 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 |
Methods
Section titled “Methods”pub
fn test(name: impl Into<String>) -> SelfCreate 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), } }with_doc
Section titled “with_doc”pub
fn with_doc(mut self, doc: impl Into<String>) -> SelfSource
pub fn with_doc(mut self, doc: impl Into<String>) -> Self { self.doc_comment = Some(doc.into()); self }with_generics
Section titled “with_generics”pub
fn with_generics(mut self, generics: impl Into<String>) -> SelfSource
pub fn with_generics(mut self, generics: impl Into<String>) -> Self { self.generics = Some(generics.into()); self }with_signature
Section titled “with_signature”pub
fn with_signature(mut self, sig: impl Into<String>) -> SelfSource
pub fn with_signature(mut self, sig: impl Into<String>) -> Self { self.signature_str = sig.into(); self }with_param
Section titled “with_param”pub
fn with_param(mut self, param: RustParam) -> SelfSource
pub fn with_param(mut self, param: RustParam) -> Self { self.signature.params.push(param); self }with_return_type
Section titled “with_return_type”pub
fn with_return_type(mut self, ty: impl Into<String>) -> SelfSource
pub fn with_return_type(mut self, ty: impl Into<String>) -> Self { self.signature.return_type = Some(ty.into()); self }async_
Section titled “async_”pub
fn async_(mut self) -> SelfSource
pub fn async_(mut self) -> Self { self.is_async = true; self }unsafe_
Section titled “unsafe_”pub
fn unsafe_(mut self) -> SelfSource
pub fn unsafe_(mut self) -> Self { self.is_unsafe = true; self }const_
Section titled “const_”pub
fn const_(mut self) -> SelfSource
pub fn const_(mut self) -> Self { self.is_const = true; self }with_pyfunction
Section titled “with_pyfunction”pub
fn with_pyfunction(mut self, meta: PyFunctionMeta) -> SelfSource
pub fn with_pyfunction(mut self, meta: PyFunctionMeta) -> Self { self.pyfunction = Some(meta); self }with_source
Section titled “with_source”pub
fn with_source(mut self, source: SourceSpan) -> SelfSource
pub fn with_source(mut self, source: SourceSpan) -> Self { self.source = source; self }struct RustFunctionSig
Section titled “struct RustFunctionSig”pub
Derives: Debug, Clone, Serialize, Deserialize
Rust function signature
Fields
Section titled “Fields”| Name | Type | Description |
|---|---|---|
params |
Vec<RustParam> |
|
return_type |
Option<String> |
struct RustParam
Section titled “struct RustParam”pub
Derives: Debug, Clone, Serialize, Deserialize
A Rust function parameter
Fields
Section titled “Fields”| Name | Type | Description |
|---|---|---|
name |
String |
|
ty |
String |
|
default |
Option<String> |
Methods
Section titled “Methods”pub
fn test(name: impl Into<String>, ty: impl Into<String>) -> SelfCreate 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
Section titled “with_default”pub
fn with_default(mut self, default: impl Into<String>) -> SelfSource
pub fn with_default(mut self, default: impl Into<String>) -> Self { self.default = Some(default.into()); self }struct PyFunctionMeta
Section titled “struct PyFunctionMeta”pub
Derives: Debug, Clone, Serialize, Deserialize
PyO3 #[pyfunction] metadata
Fields
Section titled “Fields”| Name | Type | Description |
|---|---|---|
name |
Option<String> |
|
signature |
Option<String> |
Methods
Section titled “Methods”pub
fn new() -> SelfSource
pub fn new() -> Self { Self { name: None, signature: None, } }with_name
Section titled “with_name”pub
fn with_name(mut self, name: impl Into<String>) -> SelfSource
pub fn with_name(mut self, name: impl Into<String>) -> Self { self.name = Some(name.into()); self }with_signature
Section titled “with_signature”pub
fn with_signature(mut self, sig: impl Into<String>) -> SelfSource
pub fn with_signature(mut self, sig: impl Into<String>) -> Self { self.signature = Some(sig.into()); self }struct RustTrait
Section titled “struct RustTrait”pub
Derives: Debug, Clone, Serialize, Deserialize
A Rust trait definition
Fields
Section titled “Fields”| 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 |
struct RustAssociatedType
Section titled “struct RustAssociatedType”pub
Derives: Debug, Clone, Serialize, Deserialize
A Rust associated type in a trait
Fields
Section titled “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
Section titled “struct RustImpl”pub
Derives: Debug, Clone, Serialize, Deserialize
A Rust impl block
Fields
Section titled “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
Section titled “struct RustConst”pub
Derives: Debug, Clone, Serialize, Deserialize
A Rust const item
Fields
Section titled “Fields”| Name | Type | Description |
|---|---|---|
name |
String |
|
visibility |
Visibility |
|
doc_comment |
Option<String> |
|
ty |
String |
|
value |
Option<String> |
|
source |
SourceSpan |
struct RustTypeAlias
Section titled “struct RustTypeAlias”pub
Derives: Debug, Clone, Serialize, Deserialize
A Rust type alias
Fields
Section titled “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
Section titled “struct PythonModule”pub
Derives: Debug, Clone, Serialize, Deserialize
A Python module
Fields
Section titled “Fields”| Name | Type | Description |
|---|---|---|
path |
String |
|
docstring |
Option<String> |
|
parsed_doc |
Option<ParsedDocstring> |
|
items |
Vec<PythonItem> |
|
source_type |
SourceType |
|
source |
SourceSpan |
Methods
Section titled “Methods”pub
fn test(path: impl Into<String>) -> SelfCreate 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), } }with_docstring
Section titled “with_docstring”pub
fn with_docstring(mut self, doc: impl Into<String>) -> SelfSource
pub fn with_docstring(mut self, doc: impl Into<String>) -> Self { self.docstring = Some(doc.into()); self }with_item
Section titled “with_item”pub
fn with_item(mut self, item: PythonItem) -> SelfSource
pub fn with_item(mut self, item: PythonItem) -> Self { self.items.push(item); self }pyo3_binding
Section titled “pyo3_binding”pub
fn pyo3_binding(mut self) -> SelfSource
pub fn pyo3_binding(mut self) -> Self { self.source_type = SourceType::PyO3Binding; self }with_source
Section titled “with_source”pub
fn with_source(mut self, source: SourceSpan) -> SelfSource
pub fn with_source(mut self, source: SourceSpan) -> Self { self.source = source; self }struct PythonClass
Section titled “struct PythonClass”pub
Derives: Debug, Clone, Serialize, Deserialize
A Python class
Fields
Section titled “Fields”| 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 |
Methods
Section titled “Methods”pub
fn test(name: impl Into<String>) -> SelfCreate 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), } }with_docstring
Section titled “with_docstring”pub
fn with_docstring(mut self, doc: impl Into<String>) -> SelfSource
pub fn with_docstring(mut self, doc: impl Into<String>) -> Self { self.docstring = Some(doc.into()); self }with_base
Section titled “with_base”pub
fn with_base(mut self, base: impl Into<String>) -> SelfSource
pub fn with_base(mut self, base: impl Into<String>) -> Self { self.bases.push(base.into()); self }with_method
Section titled “with_method”pub
fn with_method(mut self, method: PythonFunction) -> SelfSource
pub fn with_method(mut self, method: PythonFunction) -> Self { self.methods.push(method); self }with_attribute
Section titled “with_attribute”pub
fn with_attribute(mut self, attr: PythonVariable) -> SelfSource
pub fn with_attribute(mut self, attr: PythonVariable) -> Self { self.attributes.push(attr); self }with_decorator
Section titled “with_decorator”pub
fn with_decorator(mut self, decorator: impl Into<String>) -> SelfSource
pub fn with_decorator(mut self, decorator: impl Into<String>) -> Self { self.decorators.push(decorator.into()); self }with_rust_impl
Section titled “with_rust_impl”pub
fn with_rust_impl(mut self, rust_ref: RustItemRef) -> SelfSource
pub fn with_rust_impl(mut self, rust_ref: RustItemRef) -> Self { self.rust_impl = Some(rust_ref); self }with_source
Section titled “with_source”pub
fn with_source(mut self, source: SourceSpan) -> SelfSource
pub fn with_source(mut self, source: SourceSpan) -> Self { self.source = source; self }struct PythonFunction
Section titled “struct PythonFunction”pub
Derives: Debug, Clone, Serialize, Deserialize
A Python function
Fields
Section titled “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
Section titled “Methods”pub
fn test(name: impl Into<String>) -> SelfCreate 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
Section titled “with_docstring”pub
fn with_docstring(mut self, doc: impl Into<String>) -> SelfSource
pub fn with_docstring(mut self, doc: impl Into<String>) -> Self { self.docstring = Some(doc.into()); self }with_signature
Section titled “with_signature”pub
fn with_signature(mut self, sig: impl Into<String>) -> SelfSource
pub fn with_signature(mut self, sig: impl Into<String>) -> Self { self.signature_str = sig.into(); self }with_param
Section titled “with_param”pub
fn with_param(mut self, param: PythonParam) -> SelfSource
pub fn with_param(mut self, param: PythonParam) -> Self { self.signature.params.push(param); self }with_return_type
Section titled “with_return_type”pub
fn with_return_type(mut self, ty: impl Into<String>) -> SelfSource
pub fn with_return_type(mut self, ty: impl Into<String>) -> Self { self.signature.return_type = Some(ty.into()); self }with_decorator
Section titled “with_decorator”pub
fn with_decorator(mut self, decorator: impl Into<String>) -> SelfSource
pub fn with_decorator(mut self, decorator: impl Into<String>) -> Self { self.decorators.push(decorator.into()); self }async_
Section titled “async_”pub
fn async_(mut self) -> SelfSource
pub fn async_(mut self) -> Self { self.is_async = true; self }staticmethod
Section titled “staticmethod”pub
fn staticmethod(mut self) -> SelfSource
pub fn staticmethod(mut self) -> Self { self.is_staticmethod = true; self }classmethod
Section titled “classmethod”pub
fn classmethod(mut self) -> SelfSource
pub fn classmethod(mut self) -> Self { self.is_classmethod = true; self }property
Section titled “property”pub
fn property(mut self) -> SelfSource
pub fn property(mut self) -> Self { self.is_property = true; self }with_rust_impl
Section titled “with_rust_impl”pub
fn with_rust_impl(mut self, rust_ref: RustItemRef) -> SelfSource
pub fn with_rust_impl(mut self, rust_ref: RustItemRef) -> Self { self.rust_impl = Some(rust_ref); self }with_source
Section titled “with_source”pub
fn with_source(mut self, source: SourceSpan) -> SelfSource
pub fn with_source(mut self, source: SourceSpan) -> Self { self.source = source; self }struct PythonFunctionSig
Section titled “struct PythonFunctionSig”pub
Derives: Debug, Clone, Serialize, Deserialize
Python function signature
Fields
Section titled “Fields”| Name | Type | Description |
|---|---|---|
params |
Vec<PythonParam> |
|
return_type |
Option<String> |
struct PythonParam
Section titled “struct PythonParam”pub
Derives: Debug, Clone, Serialize, Deserialize
A Python function parameter
Fields
Section titled “Fields”| Name | Type | Description |
|---|---|---|
name |
String |
|
ty |
Option<String> |
|
default |
Option<String> |
Methods
Section titled “Methods”pub
fn test(name: impl Into<String>) -> SelfCreate a test parameter
Source
pub fn test(name: impl Into<String>) -> Self { Self { name: name.into(), ty: None, default: None, } }with_type
Section titled “with_type”pub
fn with_type(mut self, ty: impl Into<String>) -> SelfSource
pub fn with_type(mut self, ty: impl Into<String>) -> Self { self.ty = Some(ty.into()); self }with_default
Section titled “with_default”pub
fn with_default(mut self, default: impl Into<String>) -> SelfSource
pub fn with_default(mut self, default: impl Into<String>) -> Self { self.default = Some(default.into()); self }struct PythonVariable
Section titled “struct PythonVariable”pub
Derives: Debug, Clone, Serialize, Deserialize
A Python variable/attribute
Fields
Section titled “Fields”| Name | Type | Description |
|---|---|---|
name |
String |
|
ty |
Option<String> |
|
value |
Option<String> |
|
docstring |
Option<String> |
Methods
Section titled “Methods”pub
fn test(name: impl Into<String>) -> SelfCreate a test variable
Source
pub fn test(name: impl Into<String>) -> Self { Self { name: name.into(), ty: None, value: None, docstring: None, } }with_type
Section titled “with_type”pub
fn with_type(mut self, ty: impl Into<String>) -> SelfSource
pub fn with_type(mut self, ty: impl Into<String>) -> Self { self.ty = Some(ty.into()); self }with_value
Section titled “with_value”pub
fn with_value(mut self, value: impl Into<String>) -> SelfSource
pub fn with_value(mut self, value: impl Into<String>) -> Self { self.value = Some(value.into()); self }with_docstring
Section titled “with_docstring”pub
fn with_docstring(mut self, doc: impl Into<String>) -> SelfSource
pub fn with_docstring(mut self, doc: impl Into<String>) -> Self { self.docstring = Some(doc.into()); self }struct ParsedDocstring
Section titled “struct ParsedDocstring”pub
Derives: Debug, Clone, Serialize, Deserialize
Parsed docstring (Google/NumPy style)
Fields
Section titled “Fields”| Name | Type | Description |
|---|---|---|
summary |
Option<String> |
|
description |
Option<String> |
|
params |
Vec<ParamDoc> |
|
returns |
Option<ReturnDoc> |
|
raises |
Vec<RaisesDoc> |
|
examples |
Vec<String> |
struct ParamDoc
Section titled “struct ParamDoc”pub
Derives: Debug, Clone, Serialize, Deserialize
Documented parameter
Fields
Section titled “Fields”| Name | Type | Description |
|---|---|---|
name |
String |
|
ty |
Option<String> |
|
description |
String |
struct ReturnDoc
Section titled “struct ReturnDoc”pub
Derives: Debug, Clone, Serialize, Deserialize
Documented return value
Fields
Section titled “Fields”| Name | Type | Description |
|---|---|---|
ty |
Option<String> |
|
description |
String |
struct RaisesDoc
Section titled “struct RaisesDoc”pub
Derives: Debug, Clone, Serialize, Deserialize
Documented exception
Fields
Section titled “Fields”| Name | Type | Description |
|---|---|---|
ty |
String |
|
description |
String |
struct RustItemRef
Section titled “struct RustItemRef”pub
Derives: Debug, Clone, Serialize, Deserialize
Reference to a Rust item
Fields
Section titled “Fields”| Name | Type | Description |
|---|---|---|
path |
String |
|
name |
String |
Methods
Section titled “Methods”pub
fn new(path: impl Into<String>, name: impl Into<String>) -> SelfSource
pub fn new(path: impl Into<String>, name: impl Into<String>) -> Self { Self { path: path.into(), name: name.into(), } }struct CrossRef
Section titled “struct CrossRef”pub
Derives: Debug, Clone, Serialize, Deserialize
Cross-reference between Python and Rust
Fields
Section titled “Fields”| Name | Type | Description |
|---|---|---|
python_path |
String |
|
rust_path |
String |
|
relationship |
CrossRefKind |
Methods
Section titled “Methods”binding
Section titled “binding”pub
fn binding( python_path: impl Into<String>, rust_path: impl Into<String>,) -> SelfSource
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>,) -> SelfSource
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
Section titled “delegates”pub
fn delegates( python_path: impl Into<String>, rust_path: impl Into<String>,) -> SelfSource
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
Section titled “struct DocModel”pub
Derives: Debug, Clone, Serialize, Deserialize
The complete documentation model for a project
Fields
Section titled “Fields”| Name | Type | Description |
|---|---|---|
metadata |
ProjectMetadata |
|
rust_modules |
Vec<RustModule> |
|
python_modules |
Vec<PythonModule> |
|
cross_refs |
Vec<CrossRef> |
Methods
Section titled “Methods”pub
fn test(name: impl Into<String>) -> SelfCreate 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
Section titled “with_rust_module”pub
fn with_rust_module(mut self, module: RustModule) -> SelfSource
pub fn with_rust_module(mut self, module: RustModule) -> Self { self.rust_modules.push(module); self }with_python_module
Section titled “with_python_module”pub
fn with_python_module(mut self, module: PythonModule) -> SelfSource
pub fn with_python_module(mut self, module: PythonModule) -> Self { self.python_modules.push(module); self }with_cross_ref
Section titled “with_cross_ref”pub
fn with_cross_ref(mut self, cross_ref: CrossRef) -> SelfSource
pub fn with_cross_ref(mut self, cross_ref: CrossRef) -> Self { self.cross_refs.push(cross_ref); self }struct ProjectMetadata
Section titled “struct ProjectMetadata”pub
Derives: Debug, Clone, Serialize, Deserialize
Project metadata
Fields
Section titled “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
Section titled “Methods”pub
fn test(name: impl Into<String>) -> SelfCreate 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
Section titled “with_version”pub
fn with_version(mut self, version: impl Into<String>) -> SelfSource
pub fn with_version(mut self, version: impl Into<String>) -> Self { self.version = Some(version.into()); self }with_description
Section titled “with_description”pub
fn with_description(mut self, desc: impl Into<String>) -> SelfSource
pub fn with_description(mut self, desc: impl Into<String>) -> Self { self.description = Some(desc.into()); self }with_git_ref
Section titled “with_git_ref”pub
fn with_git_ref(mut self, git_ref: impl Into<String>) -> SelfSource
pub fn with_git_ref(mut self, git_ref: impl Into<String>) -> Self { self.git_ref = Some(git_ref.into()); self }with_git_commit
Section titled “with_git_commit”pub
fn with_git_commit(mut self, commit: impl Into<String>) -> SelfSource
pub fn with_git_commit(mut self, commit: impl Into<String>) -> Self { self.git_commit = Some(commit.into()); self }enum SourceType
Section titled “enum SourceType”pub
Source type indicator for Python modules
Variants
Section titled “Variants”Python- Pure Python source codePyO3Binding- Rust code exposed via PyO3Rust- Pure Rust (no Python exposure)
enum Visibility
Section titled “enum Visibility”pub
Visibility level for Rust items
Variants
Section titled “Variants”PublicPubCratePubSuperPrivate
enum PyModuleAddKind
Section titled “enum PyModuleAddKind”pub
What a PyModuleAdd adds.
Variants
Section titled “Variants”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 modulePymodule-m.add_submodule(wrap_pymodule!(f)): the#[pymodule]functionf(the path) is a submodule
enum RustItem
Section titled “enum RustItem”pub
A Rust item (struct, enum, function, etc.)
Variants
Section titled “Variants”StructEnumFunctionTraitImplConstTypeAlias
enum PythonItem
Section titled “enum PythonItem”pub
A Python item
Variants
Section titled “Variants”ClassFunctionVariable
enum CrossRefKind
Section titled “enum CrossRefKind”pub
Kind of cross-reference
Variants
Section titled “Variants”Binding- Direct PyO3 bindingWraps- Python wraps RustDelegates- Python delegates to Rust
