Skip to main content

Module derive

Module derive 

Source
Expand description

Runtime support for #[derive(Verit)] — the Rust peer of Python’s @verit decorator.

The verit-derive proc-macro generates an impl of VeritType for a struct: it builds the struct’s Schema from the field types (and every nested #[derive(Verit)] type it references), then rides the dynamic encoder and reader for to_verit / from_verit. The macro lives in a separate, feature-gated crate so verit’s default build keeps zero dependencies (syn/quote are build-only, off by default). This trait is plain Rust and always present — it costs nothing when the macro is unused.

The wire contract is the schema’s 128-bit content id: a Rust #[derive(Verit)] type, a Python @verit class, and a hand-written .vsc IDL that describe the same fields all produce the same id, so their bytes interoperate.

Traits§

VeritType
Implemented by every #[derive(Verit)] type. All of it is generated; you never write an impl by hand. The provided methods (to_verit, from_verit, verit_schema_id) are the surface you actually call.