Struct cell_map::CellMap [−][src]
pub struct CellMap<L, T> where
L: Layer, { /* fields omitted */ }
Expand description
Provides a many-layer 2D map of cellular data.
Implementations
Returns the number of cells in each direction of the map.
Returns whether or not the given index is inside the map.
Get a reference to the value at the given layer and index. Returns None
if the index is
outside the bounds of the map.
Get a reference to the value at the given layer and index, without checking the bounds of the map.
Safety
This function will panic if index
is outside the map.
Get a mutable reference to the value at the given layer and index. Returns None
if the
index is outside the bounds of the map.
Get a mutable reference to the value at the given layer and index, without checking the bounds of the map.
Safety
This function will panic if index
is outside the map.
pub fn iter(&self) -> CellMapIter<'_, L, T, Many<L>, Cells>ⓘNotable traits for CellMapIter<'m, L, T, Single<L>, S>
impl<'m, L, T, S> Iterator for CellMapIter<'m, L, T, Single<L>, S> where
L: Layer,
S: Slicer<'m, L, T>, type Item = S::Output;impl<'m, L, T, S> Iterator for CellMapIter<'m, L, T, Many<L>, S> where
L: Layer,
S: Slicer<'m, L, T>, type Item = S::Output;
[src]
pub fn iter(&self) -> CellMapIter<'_, L, T, Many<L>, Cells>ⓘNotable traits for CellMapIter<'m, L, T, Single<L>, S>
impl<'m, L, T, S> Iterator for CellMapIter<'m, L, T, Single<L>, S> where
L: Layer,
S: Slicer<'m, L, T>, type Item = S::Output;impl<'m, L, T, S> Iterator for CellMapIter<'m, L, T, Many<L>, S> where
L: Layer,
S: Slicer<'m, L, T>, type Item = S::Output;
[src]Returns an iterator over each cell in all layers of the map.
pub fn iter_mut(&mut self) -> CellMapIterMut<'_, L, T, Many<L>, Cells>ⓘNotable traits for CellMapIterMut<'m, L, T, Single<L>, S>
impl<'m, L, T, S> Iterator for CellMapIterMut<'m, L, T, Single<L>, S> where
L: Layer,
S: Slicer<'m, L, T>, type Item = S::OutputMut;impl<'m, L, T, S> Iterator for CellMapIterMut<'m, L, T, Many<L>, S> where
L: Layer,
S: Slicer<'m, L, T>, type Item = S::OutputMut;impl<'m, L, T, S> Iterator for CellMapIterMut<'m, L, T, Map<L>, S> where
L: Layer,
S: Slicer<'m, L, T>, type Item = (S::Output, S::OutputMut);
[src]
pub fn iter_mut(&mut self) -> CellMapIterMut<'_, L, T, Many<L>, Cells>ⓘNotable traits for CellMapIterMut<'m, L, T, Single<L>, S>
impl<'m, L, T, S> Iterator for CellMapIterMut<'m, L, T, Single<L>, S> where
L: Layer,
S: Slicer<'m, L, T>, type Item = S::OutputMut;impl<'m, L, T, S> Iterator for CellMapIterMut<'m, L, T, Many<L>, S> where
L: Layer,
S: Slicer<'m, L, T>, type Item = S::OutputMut;impl<'m, L, T, S> Iterator for CellMapIterMut<'m, L, T, Map<L>, S> where
L: Layer,
S: Slicer<'m, L, T>, type Item = (S::Output, S::OutputMut);
[src]Returns a mutable iterator over each cell in all layers of the map.
pub fn window_iter(
&self,
semi_width: Vector2<usize>
) -> Result<CellMapIter<'_, L, T, Many<L>, Windows>, CellMapError>
[src]
pub fn window_iter(
&self,
semi_width: Vector2<usize>
) -> Result<CellMapIter<'_, L, T, Many<L>, Windows>, CellMapError>
[src]Returns an iterator over windows of cells in the map.
The semi_width
is half the size of the window in the x and y axes, not including
the central cell. E.g. to have a window which is in total 5x5, the semi_window_size
needs
to be Vector2::new(2, 2)
.
pub fn window_iter_mut(
&mut self,
semi_width: Vector2<usize>
) -> Result<CellMapIterMut<'_, L, T, Many<L>, Windows>, CellMapError>
[src]
pub fn window_iter_mut(
&mut self,
semi_width: Vector2<usize>
) -> Result<CellMapIterMut<'_, L, T, Many<L>, Windows>, CellMapError>
[src]Returns a mutable iterator over windows of cells in the map.
The semi_width
is half the size of the window in the x and y axes, not including
the central cell. E.g. to have a window which is in total 5x5, the semi_window_size
needs
to be Vector2::new(2, 2)
.
Creates a new CellMap
from the given params, filling each cell with elem
.
Creates a new CellMap
from the given params, filling each cell with T::default()
.
Trait Implementations
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations
impl<L, T> RefUnwindSafe for CellMap<L, T> where
L: RefUnwindSafe,
T: RefUnwindSafe,
impl<L, T> UnwindSafe for CellMap<L, T> where
L: UnwindSafe,
T: RefUnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more
type Output = T
type Output = T
Should always be Self
The inverse inclusion map: attempts to construct self
from the equivalent element of its
superset. Read more
pub fn is_in_subset(&self) -> bool
pub fn is_in_subset(&self) -> bool
Checks if self
is actually part of its subset T
(and can be converted to it).
pub fn to_subset_unchecked(&self) -> SS
pub fn to_subset_unchecked(&self) -> SS
Use with care! Same as self.to_subset
but without any property checks. Always succeeds.
pub fn from_subset(element: &SS) -> SP
pub fn from_subset(element: &SS) -> SP
The inclusion map: converts self
to the equivalent element of its superset.