enum_set_complement

Macro enum_set_complement 

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

Computes the complement of an enums or constants enumset at compile time.

§Performance

This macro is designed for use in const contexts, not for execution as normal code. It may be significantly slower than normal code outside const contexts.

In normal code, directly use the ! operator instead.

§Examples

#[derive(EnumSetType, Debug)]
enum Enum { A, B, C, D }

const SET: EnumSet<Enum> = enum_set!(Enum::B | Enum::C);
const CONST_SET: EnumSet<Enum> = enum_set_complement!(SET);
assert_eq!(CONST_SET, Enum::A | Enum::D);