pub trait Slicer<'a, L, T>where
L: Layer,{
type Output;
type OutputMut;
// Required methods
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:
Cellsproduces data in each cell in(x, y)order, x increasing most rapidly.Windowsproduces rectangular views in(x, y) order, x increasing most rapidly.Lineproduces cells along the line connecting two positions in the parent frame.
Slicers are designed to be used in iterators, so after a .slice or .slice_mut the user
shall call Slicer::advance() on the type.
Required Associated Types§
Required Methods§
Sourcefn slice(&self, data: &'a Array2<T>) -> Option<Self::Output>
fn slice(&self, data: &'a Array2<T>) -> Option<Self::Output>
Perform the slice on the given data layer, or None if the slicer has reached the end of
its data.
Sourcefn slice_mut(&self, data: &'a mut Array2<T>) -> Option<Self::OutputMut>
fn slice_mut(&self, data: &'a mut Array2<T>) -> Option<Self::OutputMut>
Perform a mutable slice on the given data layer, or None if the slicer has reached the
end of its data.