Trait array_map::ReverseIndexable
source · [−]pub unsafe trait ReverseIndexable: Indexable {
fn from_index(u: usize) -> Self;
}
Expand description
Allows mapping from an index to a type
Safety
This is trait is unsafe because it needs to uphold the property that it is reflexive. For example:
use array_map::*;
let index = 42_u8.index();
let u = u8::from_index(index);
assert_eq!(u, 42);
If a value greater than or equal to Self::SIZE
is provided, then this function can panic.
This library will never pass in an invalid usize value.
Required methods
fn from_index(u: usize) -> Self
fn from_index(u: usize) -> Self
Converts from a usize to Self