pub struct Grid<T: Copy> { /* private fields */ }
Implementations§
Source§impl<T: Copy> Grid<T>
impl<T: Copy> Grid<T>
pub fn new(size: Vec2<usize>, fill_value: T) -> Self
pub fn with_buffer(size: Vec2<usize>, buffer: Vec<T>) -> Option<Self>
pub fn generate(size: Vec2<usize>, generator: impl GridGenetator<T>) -> Selfwhere
T: Default,
pub fn fork(&self, fill_value: T) -> Self
pub fn fork_generate(&self, generator: impl GridGenetator<T>) -> Self
pub fn apply( &mut self, from: impl Into<Vec2<usize>>, to: impl Into<Vec2<usize>>, generator: impl GridGenetator<T>, )
pub fn apply_all(&mut self, generator: impl GridGenetator<T>)
pub fn map<U: Copy>( &self, f: impl FnMut(Vec2<usize>, Vec2<usize>, T) -> U, ) -> Grid<U>
pub fn into_inner(self) -> (Vec2<usize>, Vec<T>)
pub fn size(&self) -> Vec2<usize>
pub fn buffer(&self) -> &[T]
pub fn buffer_mut(&mut self) -> &mut [T]
pub fn iter(&self) -> impl Iterator<Item = (Vec2<usize>, usize, T)> + '_
pub fn index(&self, location: impl Into<Vec2<usize>>) -> usize
pub fn location(&self, index: usize) -> Vec2<usize>
pub fn location_offset( &self, location: Vec2<usize>, direction: GridDirection, distance: usize, ) -> Option<Vec2<usize>>
pub fn neighbors( &self, location: impl Into<Vec2<usize>>, range: Range<usize>, ) -> impl Iterator<Item = (GridDirection, Vec2<usize>, T)> + '_
pub fn get(&self, location: impl Into<Vec2<usize>>) -> Option<T>
pub fn set(&mut self, location: impl Into<Vec2<usize>>, value: 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more