Module cell_map::iterators[][src]

Expand description

Provides iterators over CellMaps.

Iterators are constructed using the iter family of functions on CellMap, such as CellMap::iter() and CellMap::window_iter_mut(). Which function you use determines which Slicer the iterator uses, in other words what order and shape the iterated items will be produced in.

Once constructed both CellMapIter and CellMapIterMut provide functions to modify the which layers are produced, and whether or not the items also produce their indexes. These can be used like iterator combinators.

Examples

Iterate over a 3x3 window of items in the Height layer, while also returning the indices of the central cell of the window:

for ((layer, index), height) in map.window_iter(Vector2::new(1, 1)).unwrap().indexed() {
    println!("[{:?}, {}, {}] = {}", layer, index.x, index.y, height);
}

Modules

Provides the Indexed wrapper type which modifies a Slicer to produce the current index as well as the value.

Provides layerer types which are used in combination with Slicer types to determine the order and form in which data is produced from the layers within a CellMap.

Provides the Positioned wrapper type which modifies a Slicer to produce the current position as well as the value.

Provides the Slicer trait and slicers types that determine the order and pattern in which data is produced by an interator over a CellMap.

Structs

A non-mutable iterator over a CellMap, see Slicer and layerers for more information.

A mutable iterator over a CellMap, see Slicer and layerers for more information.