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¶
Create a test source location
Source
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¶
Create a test source span with empty source
Source
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
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¶
Create a test Rust module
Source
with_doc pub¶
Source
with_item pub¶
with_source pub¶
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¶
Create a test struct
Source
with_visibility pub¶
with_doc pub¶
Source
with_generics pub¶
Source
with_field pub¶
with_derive pub¶
Source
with_pyclass pub¶
with_source pub¶
struct PyClassMeta¶
pub
Derives: Debug, Clone, Serialize, Deserialize
PyO3 #[pyclass] metadata
Fields¶
| Name | Type | Description |
|---|---|---|
name |
Option < String > |
|
module |
Option < String > |
Methods¶
new pub¶
with_name pub¶
Source
with_module pub¶
Source
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¶
Create a test field
Source
private pub¶
with_doc pub¶
Source
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¶
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¶
Source
with_generics pub¶
Source
with_signature pub¶
Source
with_param pub¶
Source
with_return_type pub¶
Source
async_ pub¶
unsafe_ pub¶
const_ pub¶
with_pyfunction pub¶
Source
with_source pub¶
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¶
Create a test parameter
Source
with_default pub¶
Source
struct PyFunctionMeta¶
pub
Derives: Debug, Clone, Serialize, Deserialize
PyO3 #[pyfunction] metadata
Fields¶
| Name | Type | Description |
|---|---|---|
name |
Option < String > |
|
signature |
Option < String > |
Methods¶
new pub¶
with_name pub¶
Source
with_signature pub¶
Source
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¶
Create a test Python module
Source
with_docstring pub¶
Source
with_item pub¶
pyo3_binding pub¶
with_source pub¶
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¶
Create a test Python class
Source
with_docstring pub¶
Source
with_base pub¶
Source
with_method pub¶
Source
with_attribute pub¶
Source
with_decorator pub¶
Source
with_rust_impl pub¶
Source
with_source pub¶
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¶
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¶
Source
with_signature pub¶
Source
with_param pub¶
Source
with_return_type pub¶
Source
with_decorator pub¶
Source
async_ pub¶
staticmethod pub¶
classmethod pub¶
property pub¶
with_rust_impl pub¶
Source
with_source pub¶
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¶
Create a test parameter
Source
with_type pub¶
Source
with_default pub¶
Source
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¶
Create a test variable
Source
with_type pub¶
Source
with_value pub¶
Source
with_docstring pub¶
Source
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¶
Source
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¶
Source
wraps pub¶
Source
delegates pub¶
Source
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¶
Create an empty doc model for testing
Source
with_rust_module pub¶
Source
with_python_module pub¶
Source
with_cross_ref pub¶
Source
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¶
Create test metadata
Source
with_version pub¶
Source
with_description pub¶
Source
with_git_ref pub¶
Source
with_git_commit pub¶
Source
Enums¶
enum SourceType pub¶
Source type indicator for Python modules
Variants¶
Python- Pure Python source codePyO3Binding- Rust code exposed via PyO3Rust- Pure Rust (no Python exposure)
enum Visibility pub¶
Visibility level for Rust items
Variants¶
PublicPubCratePubSuperPrivate
enum RustItem pub¶
A Rust item (struct, enum, function, etc.)
Variants¶
StructEnumFunctionTraitImplConstTypeAlias
enum PythonItem pub¶
A Python item
Variants¶
ClassFunctionVariable
enum CrossRefKind pub¶
Kind of cross-reference
Variants¶
Binding- Direct PyO3 bindingWraps- Python wraps RustDelegates- Python delegates to Rust