Trait array_map::Indexable [−][src]
pub unsafe trait Indexable { type Iter: Iterator<Item = Self>; const SIZE: usize; const SET_SIZE: usize; fn index(self) -> usize; fn iter() -> Self::Iter; }
Expand description
Allows mapping from a type to an index
This trait is unsafe because there are a few other requirements that need to be met:
- The indexes of self need to be contiguous and need to be returned in order from
iter()
- Iter needs to return exactly N items (this is checked in debug mode)
Associated Types
The type of Iterator that will be returned by Self::iter()
Associated Constants
Required methods
Maps self to usize to know which value in the underling array to use
Safety
This value can never be greater than Self::SIZE
All values in 0..SIZE
must be returned by some variant of self.