pub trait Enum {
    const LENGTH: usize;

    fn from_usize(value: usize) -> Self;
    fn into_usize(self) -> usize;
}
Expand description

Enum mapping type.

This trait is implemented by #[derive(Enum)].

This trait is also implemented by bool and u8. While u8 is strictly speaking not an actual enum, there are good reasons to consider it like one, as array of u8 keys is a relatively common pattern.

Required Associated Constants

Length of the enum.

Required Methods

Takes an usize, and returns an element matching into_usize function.

Returns an unique identifier for a value within range of 0..Array::LENGTH.

Implementations on Foreign Types

Implementors