Struct lat::Grid

source ·
pub struct Grid<T> { /* private fields */ }

Implementations§

source§

impl<T: Default + Clone> Grid<T>

source

pub fn from_defaults(width: usize, height: usize) -> Self

source§

impl<T> Grid<T>

source

pub fn from_fn( width: usize, height: usize, fun: &mut impl FnMut(usize, usize) -> T ) -> Self

source

pub fn width(&self) -> usize

source

pub fn height(&self) -> usize

source

pub fn map_once<U, F>(self, mapper: F) -> Grid<U>where F: FnMut(T) -> U,

source

pub fn map<U, F>(&self, mapper: F) -> Grid<U>where F: FnMut(&T) -> U,

source§

impl<T: Clone> Grid<T>

source

pub fn map_mut<F>(&mut self, mapper: F) -> &mut Grid<T>where F: FnMut(T) -> T,

source

pub fn map_with_neighbors<U, F>(&self, mapper: F, default: T) -> Grid<U>where F: FnMut(&[[T; 3]; 3]) -> U, U: Default,

Trait Implementations§

source§

impl<'a, R: 'static, T: Add<&'a R>> Add<&'a Grid<R>> for Grid<T>

§

type Output = Grid<<T as Add<&'a R>>::Output>

The resulting type after applying the + operator.
source§

fn add(self, rhs: &'a Grid<R>) -> Self::Output

Performs the + operation. Read more
source§

impl<'a, R, T: AddAssign<&'a R>> AddAssign<&'a Grid<R>> for Grid<T>

source§

fn add_assign(&mut self, rhs: &'a Grid<R>)

Performs the += operation. Read more
source§

impl<'a, R: 'static, T: BitAnd<&'a R>> BitAnd<&'a Grid<R>> for Grid<T>

§

type Output = Grid<<T as BitAnd<&'a R>>::Output>

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: &'a Grid<R>) -> Self::Output

Performs the & operation. Read more
source§

impl<'a, R, T: BitAndAssign<&'a R>> BitAndAssign<&'a Grid<R>> for Grid<T>

source§

fn bitand_assign(&mut self, rhs: &'a Grid<R>)

Performs the &= operation. Read more
source§

impl<'a, R: 'static, T: BitOr<&'a R>> BitOr<&'a Grid<R>> for Grid<T>

§

type Output = Grid<<T as BitOr<&'a R>>::Output>

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: &'a Grid<R>) -> Self::Output

Performs the | operation. Read more
source§

impl<'a, R, T: BitOrAssign<&'a R>> BitOrAssign<&'a Grid<R>> for Grid<T>

source§

fn bitor_assign(&mut self, rhs: &'a Grid<R>)

Performs the |= operation. Read more
source§

impl<'a, R: 'static, T: BitXor<&'a R>> BitXor<&'a Grid<R>> for Grid<T>

§

type Output = Grid<<T as BitXor<&'a R>>::Output>

The resulting type after applying the ^ operator.
source§

fn bitxor(self, rhs: &'a Grid<R>) -> Self::Output

Performs the ^ operation. Read more
source§

impl<'a, R, T: BitXorAssign<&'a R>> BitXorAssign<&'a Grid<R>> for Grid<T>

source§

fn bitxor_assign(&mut self, rhs: &'a Grid<R>)

Performs the ^= operation. Read more
source§

impl<'a, R: 'static, T: Div<&'a R>> Div<&'a Grid<R>> for Grid<T>

§

type Output = Grid<<T as Div<&'a R>>::Output>

The resulting type after applying the / operator.
source§

fn div(self, rhs: &'a Grid<R>) -> Self::Output

Performs the / operation. Read more
source§

impl<'a, R, T: DivAssign<&'a R>> DivAssign<&'a Grid<R>> for Grid<T>

source§

fn div_assign(&mut self, rhs: &'a Grid<R>)

Performs the /= operation. Read more
source§

impl<T> Index<(usize, usize)> for Grid<T>

§

type Output = T

The returned type after indexing.
source§

fn index(&self, (x, y): (usize, usize)) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
source§

impl<T> IndexMut<(usize, usize)> for Grid<T>

source§

fn index_mut(&mut self, (x, y): (usize, usize)) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
source§

impl<'a, R: 'static, T: Mul<&'a R>> Mul<&'a Grid<R>> for Grid<T>

§

type Output = Grid<<T as Mul<&'a R>>::Output>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &'a Grid<R>) -> Self::Output

Performs the * operation. Read more
source§

impl<'a, R, T: MulAssign<&'a R>> MulAssign<&'a Grid<R>> for Grid<T>

source§

fn mul_assign(&mut self, rhs: &'a Grid<R>)

Performs the *= operation. Read more
source§

impl<'a, T: Neg> Neg for Grid<T>

§

type Output = Grid<<T as Neg>::Output>

The resulting type after applying the - operator.
source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
source§

impl<'a, T: Not> Not for Grid<T>

§

type Output = Grid<<T as Not>::Output>

The resulting type after applying the ! operator.
source§

fn not(self) -> Self::Output

Performs the unary ! operation. Read more
source§

impl<'a, R: 'static, T: Rem<&'a R>> Rem<&'a Grid<R>> for Grid<T>

§

type Output = Grid<<T as Rem<&'a R>>::Output>

The resulting type after applying the % operator.
source§

fn rem(self, rhs: &'a Grid<R>) -> Self::Output

Performs the % operation. Read more
source§

impl<'a, R, T: RemAssign<&'a R>> RemAssign<&'a Grid<R>> for Grid<T>

source§

fn rem_assign(&mut self, rhs: &'a Grid<R>)

Performs the %= operation. Read more
source§

impl<'a, R: 'static, T: Shl<&'a R>> Shl<&'a Grid<R>> for Grid<T>

§

type Output = Grid<<T as Shl<&'a R>>::Output>

The resulting type after applying the << operator.
source§

fn shl(self, rhs: &'a Grid<R>) -> Self::Output

Performs the << operation. Read more
source§

impl<'a, R, T: ShlAssign<&'a R>> ShlAssign<&'a Grid<R>> for Grid<T>

source§

fn shl_assign(&mut self, rhs: &'a Grid<R>)

Performs the <<= operation. Read more
source§

impl<'a, R: 'static, T: Shr<&'a R>> Shr<&'a Grid<R>> for Grid<T>

§

type Output = Grid<<T as Shr<&'a R>>::Output>

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: &'a Grid<R>) -> Self::Output

Performs the >> operation. Read more
source§

impl<'a, R, T: ShrAssign<&'a R>> ShrAssign<&'a Grid<R>> for Grid<T>

source§

fn shr_assign(&mut self, rhs: &'a Grid<R>)

Performs the >>= operation. Read more
source§

impl<'a, R: 'static, T: Sub<&'a R>> Sub<&'a Grid<R>> for Grid<T>

§

type Output = Grid<<T as Sub<&'a R>>::Output>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: &'a Grid<R>) -> Self::Output

Performs the - operation. Read more
source§

impl<'a, R, T: SubAssign<&'a R>> SubAssign<&'a Grid<R>> for Grid<T>

source§

fn sub_assign(&mut self, rhs: &'a Grid<R>)

Performs the -= operation. Read more

Auto Trait Implementations§

§

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> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.