pub struct Grid2d<T> { /* private fields */ }Implementations§
Source§impl<T> Grid2d<T>
impl<T> Grid2d<T>
pub fn new(cols: usize, rows: usize, fill: T) -> Self
pub fn with_cells(cols: usize, cells: Vec<T>) -> Self
pub fn resize(&mut self, cols: usize, rows: usize, default: T)
pub fn cols(&self) -> usize
pub fn rows(&self) -> usize
pub fn size(&self) -> (usize, usize)
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn cells(&self) -> &[T]
pub fn cells_mut(&mut self) -> &mut [T]
pub fn cell(&self, col: usize, row: usize) -> Option<&T>
pub fn cell_mut(&mut self, col: usize, row: usize) -> Option<&mut T>
pub fn get(&self, col: usize, row: usize) -> Option<T>
pub fn set(&mut self, col: usize, row: usize, value: T)
pub fn get_col_cells(&self, index: usize) -> Option<Vec<T>>
pub fn get_row_cells(&self, index: usize) -> Option<Vec<T>>
pub fn copy_part(&self, range: Range<(usize, usize)>, result: &mut Self)where
T: Default,
pub fn get_part(&self, range: Range<(usize, usize)>) -> Self
pub fn get_view(&self, range: Range<(usize, usize)>) -> Grid2d<&T>
pub fn copy_sample(
&self,
(col, row): (usize, usize),
margin: usize,
result: &mut Self,
)where
T: Default,
pub fn sample(&self, (col, row): (usize, usize), margin: usize) -> Self
pub fn view_sample( &self, (col, row): (usize, usize), margin: usize, ) -> Grid2d<&T>
pub fn sin_map<F, R>(&self, f: F) -> Grid2d<R>
pub fn map<F, R>(&self, f: F) -> Grid2d<R>
pub fn sin_with<F>(&mut self, f: F)
pub fn with<F>(&mut self, f: F)
pub fn iter(&self) -> impl Iterator<Item = &T>
pub fn iter_view( &self, range: Range<(usize, usize)>, ) -> impl Iterator<Item = (usize, usize, &T)>
pub fn iter_sample<'a>( &'a self, range: Range<(usize, usize)>, margin: usize, ) -> impl Iterator<Item = (usize, usize, Grid2d<&T>)> + 'a
pub fn iter_mut(&mut self) -> impl Iterator<Item = &mut T>
pub fn iter_view_mut( &mut self, range: Range<(usize, usize)>, ) -> impl Iterator<Item = (usize, usize, &mut T)>
pub fn neighbor_sample( &self, (col, row): (usize, usize), ) -> Grid2dNeighborSample<T>
pub fn into_inner(self) -> (usize, usize, Vec<T>)
Trait Implementations§
Source§impl<'de, T> Deserialize<'de> for Grid2d<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for Grid2d<T>where
T: Deserialize<'de>,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<T> IntoIterator for Grid2d<T>
impl<T> IntoIterator for Grid2d<T>
Auto Trait Implementations§
impl<T> Freeze for Grid2d<T>
impl<T> RefUnwindSafe for Grid2d<T>where
T: RefUnwindSafe,
impl<T> Send for Grid2d<T>where
T: Send,
impl<T> Sync for Grid2d<T>where
T: Sync,
impl<T> Unpin for Grid2d<T>where
T: Unpin,
impl<T> UnwindSafe for Grid2d<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more