[−][src]Trait enumflags2::RawBitFlags
A trait automatically implemented by derive(BitFlags) to make the enum
a valid type parameter for BitFlags<T>.
Provided methods
fn empty() -> BitFlags<Self>
Create a BitFlags with no flags set (in other words, with a value of 0).
This is a convenience reexport of BitFlags::empty. It can be called with
MyFlag::empty(), thus bypassing the need for type hints in some situations.
#[derive(Clone, Copy, PartialEq, Eq, BitFlags)] enum MyFlag { One = 1 << 0, Two = 1 << 1, Three = 1 << 2, } use enumflags2::RawBitFlags; let empty = MyFlag::empty(); assert!(empty.is_empty()); assert_eq!(empty.contains(MyFlag::One), false); assert_eq!(empty.contains(MyFlag::Two), false); assert_eq!(empty.contains(MyFlag::Three), false);
fn all() -> BitFlags<Self>
Create a BitFlags with all flags set.
This is a convenience reexport of BitFlags::all. It can be called with
MyFlag::all(), thus bypassing the need for type hints in some situations.
#[derive(Clone, Copy, PartialEq, Eq, BitFlags)] enum MyFlag { One = 1 << 0, Two = 1 << 1, Three = 1 << 2, } use enumflags2::RawBitFlags; let empty = MyFlag::all(); assert!(empty.is_all()); assert_eq!(empty.contains(MyFlag::One), true); assert_eq!(empty.contains(MyFlag::Two), true); assert_eq!(empty.contains(MyFlag::Three), true);