Expand description
Procedural macros for the bnb crate.
bitfield— pack typed fields into one backing integer with explicit bit and byte order.bitflags— pack named single-bit flags into one integer, with set algebra.BitEnum— derive enum ⇄ integer with an optional catch-all.BitDecode/BitEncode— the low-level read/write codec derives (fields at arbitrary bit offsets).bin— the unified whole-message codec attribute, folding the codec derives plus a builder (also dispatches tagged-union enums).BitsBuilder— a required-by-default builder.
These are re-exported from bnb; depend on that crate, not this one.
Attribute Macros§
- bin
#[bin]— the unified whole-message bit codec. One attribute that folds the read codec (BitDecode), the write codec (BitEncode), and a required-by-default builder (BitsBuilder) over a struct ofbnb::Bitsfields, read and written at arbitrary bit offsets.- bitfield
- Packs the annotated struct’s fields into a single backing integer.
- bitflags
- Packs named single-bit flags into one backing integer, with set algebra.
Derive Macros§
- BitDecode
- Derives a
bnb::BitDecodeimpl that reads the struct’s named fields, in declaration order, from a bit cursor (abnb::BitReader). - BitEncode
- Derives a
bnb::BitEncodeimpl — the dual ofBitDecode, writing the struct’s named fields in order to abnb::BitWriterbit cursor. SharesBitDecode’s right-tool guard and#[bit_stream(...)]override. - BitEnum
- Derives an enum ⇄ integer mapping of a fixed bit width.
- Bits
Builder - Generates a
derive_builder-style builder for a struct (or, when listed in a#[bitfield]’s derives, for the bitfield — intercepted by#[bitfield]).