modular-bitfield
modular-bitfield copied to clipboard
Add ::BITS or ::BYTES constant for generated structs
It would be helpful to have a constant on each bitfield struct that indicates its length, for example
#[bitfield]
pub struct MyFourBytes {
a: B1,
b: B3,
c: B4,
d: B24,
}
should have:
MyFourBytes::BITS; // equals 32
So I can easily determine the length of the struct, when reading/creating byte arrays.