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
17
18
//! `auto_len` naming a field that doesn't exist is a clear error, not a silently-ignored
//! spec that leaves the nested `WireLen` unresolved.
use bnb::{WireLen, bin};

#[bin(big)]
#[derive(Clone)]
struct Hdr {
    n: WireLen<u16>,
}

#[bin(big, auto_len(headr.n = count(items)))]
struct Msg {
    hdr: Hdr,
    #[br(count = hdr.n.to_count())]
    items: Vec<u8>,
}

fn main() {}