pub trait Enumerated {
    fn position(&self) -> usize;
    fn len() -> usize;
}
Expand description

Provides means to map enum values to positions in arrays backing an EnumMap/EnumTable. Not intended to be implemented by hand. Annotating an enum with the #[enum_collections] attribute macro is preferred.

 use enum_collections::{enum_collections, Enumerated};
#[enum_collections]
enum Letter {
    A,
    B,
}

Required Methods§

Maps an enum to a unique position in an array.

Total number of values in an Enum.

Implementors§