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
//! A `count`-bearing (variable-length) message implements `BitDecode`/`BitEncode`
//! but NOT `FixedBitLen` — so asking for its const `BIT_LEN` is a compile error.
use bnb::{FixedBitLen, bin};

#[bin]
struct Msg {
    tag: bnb::u4,
    n: u8,
    #[br(count = n)]
    data: Vec<u8>,
}

fn main() {
    let _ = <Msg as FixedBitLen>::BIT_LEN;
}