Rydantic derive
Procedural macros for Rydantic, a Rust library for data modeling, validation, JSON Schema and native Cap'n Proto.
Use the rydantic crate, which enables and re-exports #[derive(Model)] by default:
[]
= "0.3.0"
use Model;
let user = parse_json?;
assert_eq!;
# Ok::
See the API documentation and complete guide for borrowing, validators, model attributes, schemas and Cap'n Proto mappings.
With rydantic's capnp feature, #[rydantic::capnp_models] on an inline model module also infers the complete Cap'n Proto schema, invokes the installed official capnp compiler, and generates native Rust bindings automatically. Consumers maintain Rust model definitions without a separate schema, generated source file, or build script. The schema is available through CapnpSchema and the model module's CAPNP_SCHEMA constant.
License: MIT.