Skip to content

0.5.6

Compare
Choose a tag to compare
@wrenger wrenger released this 10 Dec 23:26
· 37 commits to main since this release

This release introduces a new parameter to the #[bits] attribute for making fields read-only or write-only.

#[bitfield(u16)]
struct MyBitfield {
    #[bits(8, access = RO)]
    read: u8,
    #[bits(8, access = WO)]
    write: u8,
}

let v = MyBitfield::new().with_write(0xea);
assert_eq!(v.0, 0xea00);
assert_eq!(v.read(), 0);

Thanks to @paul1999 for implementing this feature.