auto-bitflags is a rust macro to automatically generate bitflags.
#[macro_use]
extern crate auto-bitflags;
auto-bitflags!(FLAG1, FLAG2);
fn main() {
assert_eq!(0b11, FLAG_FLAG1 | FLAG_FLAG2);
let flag12 = FLAG_FLAG1 | FLAG_FLAG2;
assert_eq!(0b1, flag12 & FLAG_FLAG2);
assert_eq!(0b10, flag12 & FLAG_FLAG1);
}