Expand description
Procedural derives used by rustbinary.
Applications normally enable the matching rustbinary feature and use the
derives re-exported by the main crate. Generated paths intentionally refer
to ::rustbinary, keeping the runtime traits and wire implementation owned
by one crate.
The procedural macro runs on the host with std, but generated code uses
only core syntax and the selected RustBinary runtime traits, so consumers
may expand these derives in no_std crates.
§Macro selection
Fingerprintgenerates a compatibility identifier for type structure and codec configuration.StaticSizegenerates finite normal and bit-packed size bounds for statically sized values.Reflectgenerates allocation-free structural metadata.BitPackedgenerates a checked bit-level codec for bounded fields and nestedBitPackvalues.CompactBinarygenerates the schema-guided compact profile codec (CompactEncode+CompactDecode).
The generated implementations are not a replacement for the nextjson
derives. Add NsonSerialize and NsonDeserialize when the value also
crosses a normal rustbinary or CBOR wire profile. For the complete syntax
and production constraints, see the package README and the re-exported
runtime traits.
Derive Macros§
- Archive
- Derives the zero-copy archived mirror used by
rustbinary::archive::build/OwnedArchive/MappedArchive. - BitPacked
- Derives
rustbinary::BitPackfor structs and enums. - Compact
Binary - Derives
rustbinary::compact::CompactEncodeandrustbinary::compact::CompactDecode— the schema-guided compact binary profile. - Decode
Bounded - Derives
rustbinary::DecodeBounded, the schema-derived resource cost algebra(B, A, D, W)= (max input bytes, max allocation, max nesting depth, max work) that mirrors the parser structure. - Fingerprint
- Derives
rustbinary::Fingerprintfrom structural type metadata. - Reflect
- Derives allocation-free structural reflection metadata.
- Serialize
- Derives
rustbinary::archive_codec::ArchiveWrite, the two-phase archive serializer (skeleton pass then bodies pass). - Static
Size - Derives compile-time normal and bit-packed size bounds.