[][src]Trait grid_2d::coord_system::CoordSystem

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 { ... } }

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

Associated Types

type CoordIter: Iterator<Item = Coord>

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

Loading content...

Required methods

fn size(&self) -> Size

The size of the grid

fn index_of_coord_unchecked(&self, coord: Coord) -> usize

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

fn coord_iter(&self) -> Self::CoordIter

Returns an iterator over coords

Loading content...

Provided methods

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

Loading content...

Implementors

impl CoordSystem for XThenY[src]

Loading content...