pub trait CoordSystem {
    type CoordIter: Iterator<Item = Coord>;

    fn size(&self) -> Size;
    fn index_of_coord_unchecked(&self, coord: Coord) -> usize;
    fn coord_iter(&self) -> Self::CoordIter;

    fn index_of_coord_checked(&self, coord: Coord) -> usize { ... }
    fn index_of_coord(&self, coord: Coord) -> Option<usize> { ... }
    fn index_of_normalized_coord(&self, coord: Coord) -> usize { ... }
}
Expand description

A mapping from coordinate to position in the Vec backing the grid. Generally implementations will own the size of the grid.

Required Associated Types

An iterator which yields coords in thet same order as elements are stored in the grid.

Required Methods

The size of the grid

Given a coord, returns the index of the backing Vec which corresponds to that coordinate. May assume that coord.is_valid(self.size()).

Returns an iterator over coords

Provided Methods

Implementors