pub trait Enum<const LENGTH: usize>: Copy + Sized {
const LENGTH: usize = LENGTH;
// Required methods
fn from_index(index: usize) -> Option<Self>;
fn to_index(value: Self) -> usize;
}
Expand description
Provided Associated Constants§
Required Methods§
sourcefn from_index(index: usize) -> Option<Self>
fn from_index(index: usize) -> Option<Self>
Converts an index to an enum variant.
Passed index
must be in range 0..LENGTH
.
Object Safety§
This trait is not object safe.