1 stable release

Uses old Rust 2015

1.0.3 Apr 20, 2017
1.0.1 Apr 19, 2017

#46 in #bit-flags

BSD-3-Clause

4KB
65 lines

Build Status

auto-bitflags


auto-bitflags is a rust macro to automatically generate bitflags.


Usage

#[macro_use]
extern crate auto_bitflags;

auto-bitflags!(u32, 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);
}

No runtime deps