enumset

Macro enum_set_union

Source
macro_rules! enum_set_union {
    ($value:path $(,)?) => { ... };
    ($value:path, $($rest:path),* $(,)?) => { ... };
}
Expand description

Computes the union of multiple enums or constants enumset at compile time.

The syntax used is enum_set_union!(ENUM_A, ENUM_B, ENUM_C), computing the equivalent of ENUM_A | ENUM_B | ENUM_C at compile time. Each variant must be of the same type, or an error will occur at compile-time.

ยงExamples

const CONST_SET: EnumSet<Enum> = enum_set_union!(Enum::A, Enum::B);
assert_eq!(CONST_SET, Enum::A | Enum::B);