structio 0.1.0
First release. JSON and BEVE read straight into your structs and written straight out of them: no Value enum, no token stream, no document model.
[dependencies]
structio = "0.1"- JSON and BEVE from one schema.
object!,array!,unit_enum!andtagged_enum!declare a type's fields once; both formats read and write against that declaration. Keys are hashed at compile time into a perfect hash chosen to fit the key set. - No dependencies and no proc-macros. Standard library only. Rust 2024 edition, MSRV 1.96.
- Declarations are checked against the type. Leaving out a field, or naming the same key twice, is a compile error that names what is wrong. End a declaration with
..where the omission is deliberate. - Case rules.
object!(Root as "camelCase" { .. })converts every key the declaration does not spell out, during compilation. - Reads reuse allocations.
read_intoandwrite_intorefill the buffers a value already holds, so a loop over records of one shape settles into no allocation. - Compile-time options. Indentation, inline arrays, skipping null members, refusing unknown keys, requiring declared keys, and JSONC comments. Unused settings cost nothing.
- BEVE beyond whole-document decoding. Read the one value a JSON Pointer names, validate without decoding, write numeric arrays a reader can borrow rather than copy.
- Streaming in both formats, both directions, and
beve_to_jsonrewrites a BEVE document as JSON in one walk with no schema and no tree. - Errors locate themselves. A byte offset, a line/column/caret rendering against the input, and a named key for a missing one.
The API is not frozen before 1.0. Full notes in CHANGELOG.md, documentation in docs/.