Trait cell_map::iterators::slicers::Slicer [−][src]
pub trait Slicer<'a, L, T> where
L: Layer, { type Output; type OutputMut; fn slice(&self, data: &'a Array2<T>) -> Option<Self::Output>; fn slice_mut(&self, data: &'a mut Array2<T>) -> Option<Self::OutputMut>; fn advance(&mut self); fn index(&self) -> Option<Point2<usize>>; fn reset(&mut self, layer: Option<L>); }
Expand description
Trait which allows a CellMapIter
or CellMapIterMut
struct to determine what shape the
data in the iteration should be produced in. For example:
Cells
produces data in each cell in(x, y)
order, x increasing most rapidly.Windows
produces rectangular views in(x, y
) order, x increasing most rapidly.Line
produces cells along the line connecting two positions in the parent frame.
Slicer
s are designed to be used in iterators, so after a .slice
or .slice_mut
the user
shall call Slicer::advance()
on the type.
Associated Types
Required methods
Perform the slice on the given data
layer, or None
if the slicer has reached the end of
its data.
Perform a mutable slice on the given data
layer, or None
if the slicer has reached the
end of its data.
Return the current index of the Slicer
, or None
if the slicer has reached the end of
its data.