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.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.