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
//! A `#[bin(ctx(...))]` type declares context it needs, so it has no plain
//! `decode`/`decode_exact` (and no `BitDecode` impl) — it must be decoded with
//! context via `decode_with`. Calling the plain entry point is a compile error.
use bnb::bin;

#[bin(ctx(tag: u8))]
struct Value {
    a: bnb::u4,
    b: bnb::u4,
}

fn main() {
    let _ = Value::decode_exact(&[0u8]);
}