pub struct Grid<C: Cell = Tile> { /* private fields */ }Expand description
2D grid of cells
Implementations§
Source§impl<C: Cell> Grid<C>
impl<C: Cell> Grid<C>
pub fn new(width: usize, height: usize) -> Self
pub fn width(&self) -> usize
pub fn height(&self) -> usize
pub fn in_bounds(&self, x: i32, y: i32) -> bool
pub fn get(&self, x: i32, y: i32) -> Option<&C>
pub fn get_mut(&mut self, x: i32, y: i32) -> Option<&mut C>
pub fn set(&mut self, x: i32, y: i32, cell: C) -> bool
pub fn fill(&mut self, cell: C)
pub fn fill_rect(&mut self, x: i32, y: i32, w: usize, h: usize, cell: C)
pub fn count<F: Fn(&C) -> bool>(&self, predicate: F) -> usize
pub fn iter(&self) -> impl Iterator<Item = (usize, usize, &C)>
Trait Implementations§
impl<C: Cell + Eq> Eq for Grid<C>
Auto Trait Implementations§
impl<C> Freeze for Grid<C>
impl<C> RefUnwindSafe for Grid<C>where
C: RefUnwindSafe,
impl<C> Send for Grid<C>where
C: Send,
impl<C> Sync for Grid<C>where
C: Sync,
impl<C> Unpin for Grid<C>where
C: Unpin,
impl<C> UnwindSafe for Grid<C>where
C: 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