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

The number of items or variants that this type can have.

The number of bytes it will take to represent this type in a set.

Safety

This must equal set_size(Self::SIZE)

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.

An Iterator over all valid values of self

Safety

This iterator must yield exactly Self::SIZE items

Implementations on Foreign Types

Implementors