Trait custom_enum_traits::EnumIndex
source · [−]pub trait EnumIndex {
fn from_index(idx: usize) -> Option<Self>
where
Self: Sized;
fn to_index(&self) -> usize;
}
Expand description
Index items in an enum (and take an enum index and convert it to an enum variant)
Required methods
fn from_index(idx: usize) -> Option<Self> where
Self: Sized,
fn from_index(idx: usize) -> Option<Self> where
Self: Sized,
Convert an integer into an enum variant (where the first items are enumerated first, the second items second, etc.)