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
//! A reversed `#[bits(high..=low)]` range must be a clear, spanned error — not an
//! opaque const-eval "subtract with overflow" panic.
use bnb::bitfield;

#[bitfield(u16)]
struct Reversed {
    #[bits(15..=11)] // reversed: ranges are written low..=high (i.e. 11..=15)
    opcode: bnb::u5,
    #[bits(0..=10)]
    rest: bnb::u11,
}

fn main() {}