bitfields 2.0.3

Macro for for generating bitfields from structs and enum bitflags for defining packed binary schemas in low-level systems (e.g. embedded development or emulators)
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use bitfields::bitfield;

fn main() {
    #[bitfield(u32)]
    pub struct Bitfield {
        a: u8,
        b: u8,
        c: u8,
        d: u8,
    }

    let bitfield = Bitfield::from_bits(0x78563412);

    assert_eq!(bitfield.into_bits(), 0x78563412);
}