You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be neat if there was a failable version, for cases when an enumeration with an integral repr doesn't use the full range (some bit patterns are invalid). I'm not sure if this fits within the goals of the crate, but thought I'd open the feature request anyways.
The text was updated successfully, but these errors were encountered:
Apologies for the delayed response. So you are looking for getters that return a result?
enumMyEnum{A = 1,B = 2,// others are not valid}#[bitfield(u8)]structBitfield{#[bits(4)]my_data:MyEnum,#[bits(4)]other:u8,}assert_eq!(Ok(MyEnum::B),Bitfield(0xffff_0002).my_data_checked());assert!(Bitfield(0xffff_ffff).my_data_checked().is_err());
Hey, thanks for the great crate!
It would be neat if there was a failable version, for cases when an enumeration with an integral
repr
doesn't use the full range (some bit patterns are invalid). I'm not sure if this fits within the goals of the crate, but thought I'd open the feature request anyways.The text was updated successfully, but these errors were encountered: