[−][src]Macro neli::impl_flags
Implement a container for bit flag enums where the set of flags will be condensed into a single value.
Usage
neli::impl_var!( MyFlags, u16, ThisFlag => 1, ThatFlag => 2 ); neli::impl_flags!( MyFlagSet, MyFlags, u16 );
This creates a struct called MyFlagSet
that has the following
autogenerated methods:
fn empty() -> Self
fn new(flags: &[MyFlags]) -> Self
fn set(&mut self, flag: MyFlags)
fn unset(&mut self, flag: &MyFlags)
fn contains(&self, flag: &MyFlags) -> bool
When the following example is serialized, all flags contained in
the set at the time of serialization will be converted into
u16
s and bitwise or-ed.