Trait gridly::grid::GridMut

source ·
pub trait GridMut: Grid {
    // Required method
    unsafe fn get_unchecked_mut(
        &mut self,
        location: Location
    ) -> &mut Self::Item;

    // Provided method
    fn get_mut(
        &mut self,
        location: impl LocationLike
    ) -> Result<&mut Self::Item, BoundsError> { ... }
}

Required Methods§

source

unsafe fn get_unchecked_mut(&mut self, location: Location) -> &mut Self::Item

Get a mutable reference to a cell, without doing bounds checking. Implementors of this method are allowed to assume that bounds checking has already been performed on the location, which means that implementors are allowed to do their own unsafe get_mut operations on the underlying storage, where relevant / possible.

Safety

Callers must ensure that the location has been bounds-checked before calling this method. The safe interface to GridMut automatically performs this checking for you.

Provided Methods§

source

fn get_mut( &mut self, location: impl LocationLike ) -> Result<&mut Self::Item, BoundsError>

Get a reference to a cell in a grid. Returns an error if the location is out of bounds with the specific boundary violation.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<G: GridMut> GridMut for &mut G

source§

unsafe fn get_unchecked_mut(&mut self, location: Location) -> &mut Self::Item

source§

fn get_mut( &mut self, location: impl LocationLike ) -> Result<&mut Self::Item, BoundsError>

Implementors§