Files
2026-07-30 21:12:29 -04:00

36 lines
1.0 KiB
Python

"""Pydantic to Rust type conversion.
Reads Pydantic class declarations and emits matching serde-derived Rust
structs, so one declaration backs both tiers.
What it covers: scalars, `Optional`, `list`/`set`/`tuple`, `dict`, string
`Literal`s, unions, NewTypes, references to other models and enums, and
Pydantic defaults. What it does not: methods, validators, generics, memory
layout, and enum bodies — an enum lowers to a reference by name, leaving its
declaration to the caller.
"""
from pydantic_to_rust.emit import emit_rust_struct
from pydantic_to_rust.idents import to_rust_ident, to_rust_variant_ident
from pydantic_to_rust.ir import (
DefaultValue,
FieldDecl,
ModelDecl,
Primitive,
TypeShape,
)
from pydantic_to_rust.walker import lower_annotation, walk_pydantic_model
__all__ = [
"DefaultValue",
"FieldDecl",
"ModelDecl",
"Primitive",
"TypeShape",
"emit_rust_struct",
"lower_annotation",
"to_rust_ident",
"to_rust_variant_ident",
"walk_pydantic_model",
]