Expand description
§Enum collections
See EnumMap for usage details.
A map of enum variants to values. EnumMap is a fixed-size map, where each variant of the enum is mapped to a value. This implementation of EnumMap uses safe Rust only and is a a zero-cost abstraction over an array (const-sized), where the index of the array corresponds to the position of the variant in the enum.
Because it is a thin wrapper over an array, it is stack-allocated by default. Simply std::boxed::Box
ing it will move it to the heap, at the caller’s discretion.
- Indexed by enum variants.
- IndexMut by enum variants.
- Debug if the enum is Debug.
- PartialEq if the value is PartialEq. Same for Eq.
Debug and Eq are optional features. They are enabled by default.
Re-exports§
pub use crate::enumerated::Enumerated;
Macros§
- em
- Creates an EnumMap with user-provided values.
- em_
default - Initializes an EnumMap with default values for all variants not explicitly specified.
- em_
option - Initializes an EnumMap with
Option::None
for all variants not explicitly specified.
Structs§
- EnumMap
- A map of enum variants to values. EnumMap is a fixed-size map, where each variant of the enum is mapped to a value. EnumMap is a a zero-cost abstraction over an array, where the index of the array corresponds to the position of the variant in the enum.
Derive Macros§
- Enumerated
- Creates
enum_map::Enumerated
implementation for the underlying Enum. Also derives Copy and Clone.