pub struct Grid<const W: usize, const H: usize, T> {
pub data: [[T; W]; H],
}
Expand description
A statically sized 2-dimensional array
Fields§
§data: [[T; W]; H]
Implementations§
Source§impl<const W: usize, const H: usize, T> Grid<W, H, T>
impl<const W: usize, const H: usize, T> Grid<W, H, T>
pub fn iter(&self) -> impl Iterator<Item = (usize, usize, &T)>
pub fn iter_mut(&mut self) -> impl Iterator<Item = (usize, usize, &mut T)>
pub fn get(&self, x: usize, y: usize) -> Option<&T>
pub fn get_mut(&mut self, x: usize, y: usize) -> Option<&mut T>
Sourcepub unsafe fn get_unchecked(&self, x: usize, y: usize) -> &T
pub unsafe fn get_unchecked(&self, x: usize, y: usize) -> &T
§Safety
Calling this method with an out-of-bounds index is undefined behavior even if the resulting reference is not used.
Sourcepub unsafe fn get_unchecked_mut(&mut self, x: usize, y: usize) -> &mut T
pub unsafe fn get_unchecked_mut(&mut self, x: usize, y: usize) -> &mut T
§Safety
Calling this method with an out-of-bounds index is undefined behavior even if the resulting reference is not used.
Trait Implementations§
Auto Trait Implementations§
impl<const W: usize, const H: usize, T> Freeze for Grid<W, H, T>where
T: Freeze,
impl<const W: usize, const H: usize, T> RefUnwindSafe for Grid<W, H, T>where
T: RefUnwindSafe,
impl<const W: usize, const H: usize, T> Send for Grid<W, H, T>where
T: Send,
impl<const W: usize, const H: usize, T> Sync for Grid<W, H, T>where
T: Sync,
impl<const W: usize, const H: usize, T> Unpin for Grid<W, H, T>where
T: Unpin,
impl<const W: usize, const H: usize, T> UnwindSafe for Grid<W, H, 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