bitsandbytes 0.3.2

An owned, bit-aware binary codec: fast bit/byte field types and the unified #[bin] macro.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
//! A primitive `type` alias as a `#[bitfield]` field type is not recognized by the
//! const dispatch — the macro sees only the alias token, so it emits the inherent
//! const-pair call that primitives don't have. Documented failure mode: use the bare
//! primitive name (`u8`), or wrap the type and implement it via `bnb::impl_bits!`.
use bnb::bitfield;

type Byte = u8;

#[bitfield(u16, bits = msb)]
#[derive(Clone, Copy)]
struct Framed {
    tag: Byte,
    len: u8,
}

fn main() {}