Expand description
The optional #[derive(Structio)] for structio.
Enable structio’s derive feature and write #[derive(structio::Structio)]
rather than depending on this crate by name. The derive is a front end to
the declaration macros: it reads the type and emits the object!,
array!, unit_enum! or tagged_enum! invocation you would have written,
with the attributes translated to that macro’s syntax. The impls, the key
map, the required-field mask and every rule about what is accepted are
the macros’ own, so a derived type and a declared type behave identically.
The attributes and what each expands to are documented at
docs/derive.md.
This crate has no dependencies. It walks proc_macro::TokenStream itself,
which is a few hundred lines for the shapes it has to recognize and keeps
the derive’s own build under a second.
Derive Macros§
- Structio
- Declare a struct’s or enum’s schema from its definition.