pub struct Grid2D<T> { /* private fields */ }
Expand description
A 2D array, representing a grid with X and Y space.
Implementations
sourceimpl<T> Grid2D<T> where
T: Interpretation2D,
impl<T> Grid2D<T> where
T: Interpretation2D,
pub fn new(arr: T, width: usize, chunk_size: usize) -> Grid2D<T>
pub fn write<B: IntoBounds2D<usize>, W: FnMut(usize, &mut [T::Item])>(
&mut self,
bounds: B,
write: W
)
sourcepub fn insert<B: IntoBounds2D<usize>>(&mut self, bounds: B, data: &[T::Item]) where
T::Item: Copy,
pub fn insert<B: IntoBounds2D<usize>>(&mut self, bounds: B, data: &[T::Item]) where
T::Item: Copy,
Copies the incoming slice of data onto the specified bounds within the grid. This assumes that the data has the same chunk_size as the grid.
pub fn slice<B: IntoBounds2D<usize>>(&self, bounds: B) -> Vec<&T::Item>
pub fn size(&self) -> Size2D<usize>
pub fn index<P>(&self, position: P) -> usize where
P: ToPoint2D<usize>,
pub fn values(&self) -> &[T::Item]
Trait Implementations
Auto Trait Implementations
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
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