Macro make_bitflags
macro_rules! make_bitflags {
( $enum:ident ::{ $($variant:ident)|* } ) => { ... };
( $enum:ident :: $variant:ident ) => { ... };
}
Expand description
make_bitflags!
provides a succint syntax for creating instances of
BitFlags<T>
. Instead of repeating the name of your type for each flag
you want to add, try make_bitflags!(Flags::{Foo | Bar})
.
let x = make_bitflags!(Test::{A | C});
assert_eq!(x, Test::A | Test::C);
// Also works in const contexts:
const X: BitFlags<Test> = make_bitflags!(Test::A);