Struct block_grid::BlockMut[][src]

pub struct BlockMut<'a, T, B: BlockDim> { /* fields omitted */ }

A mutable view of a 2D block contiguous in memory.

Can be obtained via BlockIterMut, which is created by calling BlockGrid::block_iter_mut.

Implementations

impl<'a, T, B: BlockDim> BlockMut<'a, T, B>[src]

pub fn coords(&self) -> Coords[src]

Returns the coordinates of the entire block.

Block coordinates mean that the (i, j) refers to the i-th row of blocks and the j-th block in that row. If you need the coordinates of the first (top-left) element, use starts_at instead.

pub fn starts_at(&self) -> Coords[src]

Returns of the coordinates of the first (top-left) element in the block.

pub fn contains(&self, (row, col): Coords) -> bool[src]

Returns true if the given coordinates are valid.

pub fn get(&self, coords: Coords) -> Option<&T>[src]

Returns a reference to the element at the given coordinates, or None if they are out-of-bounds.

pub fn get_mut(&mut self, coords: Coords) -> Option<&mut T>[src]

Returns a mutable reference to the element at the given coordinates, or None if they are out-of-bounds.

pub unsafe fn get_unchecked(&self, coords: Coords) -> &T[src]

Returns a reference to the element at the given coordinates, without bounds checking.

Safety

Calling this method with out-of-bounds coordinates is undefined-behaviour.

pub unsafe fn get_unchecked_mut(&mut self, coords: Coords) -> &mut T[src]

Returns a mutable reference to the element at the given coordinates, without bounds checking.

Safety

Calling this method with out-of-bounds coordinates is undefined-behaviour.

pub fn raw(&self) -> &[T][src]

Returns all elements in block as a slice in memory order.

pub fn raw_mut(&mut self) -> &mut [T][src]

Returns all elements in block as a mutable slice in memory order.

Trait Implementations

impl<'a, T: Debug, B: Debug + BlockDim> Debug for BlockMut<'a, T, B>[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl<'a, T, B: BlockDim> Index<(usize, usize)> for BlockMut<'a, T, B>[src]

type Output = T

The returned type after indexing.

fn index(&self, coords: Coords) -> &Self::Output[src]

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

impl<'a, T, B: BlockDim> IndexMut<(usize, usize)> for BlockMut<'a, T, B>[src]

fn index_mut(&mut self, coords: Coords) -> &mut Self::Output[src]

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

Auto Trait Implementations

impl<'a, T, B> Send for BlockMut<'a, T, B> where
    B: Send,
    T: Send

impl<'a, T, B> Sync for BlockMut<'a, T, B> where
    B: Sync,
    T: Sync

impl<'a, T, B> Unpin for BlockMut<'a, T, B> where
    B: Unpin

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

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

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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

Performs the conversion.