pub struct Grid<T> { /* private fields */ }
Implementations
sourceimpl<T> Grid<T>
impl<T> Grid<T>
pub fn new_fn<F>(size: Size, f: F) -> Selfwhere
F: FnMut(Coord) -> T,
pub fn try_new_iterator<I>(
size: Size,
iterator: I
) -> Result<Self, IteratorLengthDifferentFromSize>where
I: Iterator<Item = T>,
pub fn new_iterator<I>(size: Size, iterator: I) -> Selfwhere
I: Iterator<Item = T>,
pub fn new_grid_map<U, F>(grid: Grid<U>, f: F) -> Selfwhere
F: FnMut(U) -> T,
pub fn new_grid_map_with_coord<U, F>(grid: Grid<U>, f: F) -> Selfwhere
F: FnMut(Coord, U) -> T,
pub fn new_grid_map_ref<U, F>(grid: &Grid<U>, f: F) -> Selfwhere
F: FnMut(&U) -> T,
pub fn new_grid_map_ref_with_coord<U, F>(grid: &Grid<U>, f: F) -> Selfwhere
F: FnMut(Coord, &U) -> T,
sourceimpl<T: Clone> Grid<T>
impl<T: Clone> Grid<T>
pub fn new_clone(size: Size, value: T) -> Self
pub fn transpose_clone(&self) -> Self
sourceimpl<T> Grid<T>
impl<T> Grid<T>
pub fn width(&self) -> u32
pub fn height(&self) -> u32
pub fn size(&self) -> Size
pub fn len(&self) -> usize
pub fn iter(&self) -> GridIter<'_, T>
pub fn iter_mut(&mut self) -> GridIterMut<'_, T>
pub fn coord_iter(&self) -> CoordIter
pub fn get(&self, coord: Coord) -> Option<&T>
pub fn get_mut(&mut self, coord: Coord) -> Option<&mut T>
pub fn get_tiled(&self, coord: Coord) -> &T
pub fn get_tiled_mut(&mut self, coord: Coord) -> &mut T
pub fn index_of_coord_unchecked(&self, coord: Coord) -> usize
pub fn index_of_coord(&self, coord: Coord) -> Option<usize>
pub fn get_index_checked(&self, index: usize) -> &T
pub fn get_index_checked_mut(&mut self, index: usize) -> &mut T
pub fn get_checked(&self, coord: Coord) -> &T
pub fn get_checked_mut(&mut self, coord: Coord) -> &mut T
pub fn enumerate(&self) -> GridEnumerate<'_, T>
pub fn enumerate_mut(&mut self) -> GridEnumerateMut<'_, T>
pub fn into_enumerate(self) -> GridIntoEnumerate<T>
pub fn rows(&self) -> GridRows<'_, T>
pub fn rows_mut(&mut self) -> GridRowsMut<'_, T>
pub fn get2_mut(
&mut self,
a: Coord,
b: Coord
) -> Result<(&mut T, &mut T), Get2Error>
pub fn get2_checked_mut(&mut self, a: Coord, b: Coord) -> (&mut T, &mut T)
pub fn raw(&self) -> &[T]ⓘNotable traits for &[u8]impl Read for &[u8]impl Write for &mut [u8]
pub fn raw_mut(&mut self) -> &mut [T]ⓘNotable traits for &[u8]impl Read for &[u8]impl Write for &mut [u8]
pub fn map<U, F: FnMut(T) -> U>(self, f: F) -> Grid<U>
pub fn map_with_coord<U, F: FnMut(Coord, T) -> U>(self, f: F) -> Grid<U>
pub fn map_ref<U, F: FnMut(&T) -> U>(&self, f: F) -> Grid<U>
pub fn map_ref_with_coord<U, F: FnMut(Coord, &T) -> U>(&self, f: F) -> Grid<U>
pub fn is_on_edge(&self, coord: Coord) -> bool
pub fn edge_coord_iter(&self) -> EdgeCoordIter
pub fn edge_iter(&self) -> GridEdgeIter<'_, T>ⓘNotable traits for GridEdgeIter<'a, T>impl<'a, T> Iterator for GridEdgeIter<'a, T> type Item = &'a T;
pub fn edge_iter_mut(&mut self) -> GridEdgeIterMut<'_, T>ⓘNotable traits for GridEdgeIterMut<'a, T>impl<'a, T> Iterator for GridEdgeIterMut<'a, T> type Item = &'a mut T;
pub fn edge_enumerate(&self) -> GridEdgeEnumerate<'_, T>
pub fn edge_enumerate_mut(&mut self) -> GridEdgeEnumerateMut<'_, T>
Trait Implementations
sourceimpl<T: Ord> Ord for Grid<T>
impl<T: Ord> Ord for Grid<T>
1.21.0 · sourcefn max(self, other: Self) -> Self
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
1.21.0 · sourcefn min(self, other: Self) -> Self
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
Restrict a value to a certain interval. Read more
sourceimpl<T: PartialOrd> PartialOrd<Grid<T>> for Grid<T>
impl<T: PartialOrd> PartialOrd<Grid<T>> for Grid<T>
sourcefn partial_cmp(&self, other: &Grid<T>) -> Option<Ordering>
fn partial_cmp(&self, other: &Grid<T>) -> Option<Ordering>
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl<T: Eq> Eq for Grid<T>
impl<T> StructuralEq for Grid<T>
impl<T> StructuralPartialEq for Grid<T>
Auto Trait Implementations
impl<T> RefUnwindSafe for Grid<T>where
T: RefUnwindSafe,
impl<T> Send for Grid<T>where
T: Send,
impl<T> Sync for Grid<T>where
T: Sync,
impl<T> Unpin for Grid<T>where
T: Unpin,
impl<T> UnwindSafe for Grid<T>where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more