Module indexed_valued_enums::indexed_enum
source · Expand description
Defines a trait index enums over an array using it’s discriminant
Traits§
- Allows to get a discriminant from an enum’s variant to an usize, and also get the same variant from said discriminant, for example, having the following implementation:
Functions§
- Gets the discriminant for a variant of an enum marked with #[repr(usize)], this operation is O(1).
- Gets the variant corresponding to said discriminant, this operation is O(1) as it just gets the discriminant as a read-copy from Indexed::VARIANTS.
- Gets the variant corresponding to said discriminant, this operation is O(1) as it just gets the discriminant as a read-copy from Indexed::VARIANTS.