Skip to main content

Crate type_history_codegen

Crate type_history_codegen 

Source
Expand description

Parse field histories and generate Rust types, conversions, and schema checks.

A procedural macro or framework that calls this crate is a frontend. It supplies the authored record and the package’s frozen ledger. HistoryPlan infers the current version from field attributes. HistoryPlan::expand_authorized checks that version against the ledger, then reconstructs every retained version as an AuthorizedHistory.

generate_history emits numbered structs, the current alias, adjacent conversions, a JSON decoder, and frozen schema checks. Use generate::generate_versioned alongside it to support the Versioned wrapper. GenerationPaths tells both generators where to find runtime support and how to construct conversion errors. generate_history_with_options lets a frontend own payload traits and select a dedicated observation cfg. GeneratedVersion exposes typed payload declarations, structural shapes, and descriptive schema expressions.

Re-exports§

pub use generate::generate_history;
pub use generate::generate_history_with_options;
pub use generate::GeneratedHistory;
pub use generate::GeneratedVersion;
pub use generate::GenerationOptions;
pub use generate::GenerationPaths;
pub use generate::PayloadTraits;
pub use history::AuthorizedHistory;
pub use history::HistoryPlan;
pub use identifier::normalize_rust_identifier;
pub use model::NamedField;
pub use model::RecordDerives;
pub use model::RecordInput;

Modules§

admission
Standalone declarations checked by the build hook and matched by the macro.
canonical
RFC 8785 canonical JSON serialization for type-history schema artifacts.
diagnostics
Stable differences between compiler-resolved wire schemas.
generate
One generator for retained records, adjacent conversions, and frozen checks.
history
Field history parsing and authorized retained-version reconstruction.
identifier
Canonical names shared by generated histories and their frontends.
input
Pure standalone declaration parsing, independent of environment and ledger access.
json_schema
Normalized JSON Schema 2020-12 comparison documents for record wire snapshots.
json_schema_derive
schemars derive emission for generated persisted records.
ledger
Strict committed history authority shared by compilation and lifecycle tools.
lint_attributes
Preserve authored lint scope across generated copies of one declaration.
model
Authored record input shared by the macro and source discovery.
record
Strict map-only codecs for generated named records.
resolved_schema
Type-level wire-schema token generation.
source
Shared finite source graph and frontend declaration selection.