main.rs
use bitflags::bitflags;
bitflags! {
struct Flags: u8 {
const TWO = 0x2;
}
}
fn main() {
let value = 0b11;
let flags = unsafe { Flags::from_bits_unchecked(value) };
println!("{:?}", flags);
println!("-----------");
println!("{:#?}", flags);
}
will print the following:
TWO | 0x1
-----------
TWO | 0x0x1
the expected output would either be 0x1 for both, or 1, and 0x1 respectively