0.5.6
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.