pub struct Grid<T> {
pub rows: usize,
pub cols: usize,
pub cells: Vec<Vec<T>>,
}
Fields§
§rows: usize
§cols: usize
§cells: Vec<Vec<T>>
Implementations§
Source§impl<T> Grid<T>where
T: Debug,
impl<T> Grid<T>where
T: Debug,
pub fn new_from(data: Vec<Vec<T>>) -> Self
pub fn iter(&self) -> impl Iterator<Item = &T>
pub fn rows(&self) -> impl Iterator<Item = &Vec<T>>
pub fn cols<'a>(&'a self) -> impl Iterator<Item = impl Iterator<Item = &'a T>>
pub fn get(&self, row_index: usize, col_index: usize) -> Option<&T>
pub fn eight_neighbors<'a>( &'a self, row_origin: usize, col_origin: usize, ) -> impl Iterator<Item = &'a T>
pub fn l1_dist(&self, pt1: GridPt, pt2: GridPt) -> usize
pub fn right_from(&self, row: usize, col: usize) -> impl Iterator<Item = &T>
pub fn left_from(&self, row: usize, col: usize) -> impl Iterator<Item = &T>
pub fn up_from(&self, row: usize, col: usize) -> impl Iterator<Item = &T>
pub fn down_from(&self, row: usize, col: usize) -> impl Iterator<Item = &T>
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Grid<T>
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§
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