Struct block_grid::Block [−][src]
A view of a 2D block contiguous in memory.
Can be obtained via BlockIter, which is created by calling BlockGrid::block_iter.
Implementations
impl<'a, T, B: BlockDim> Block<'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 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 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.
Trait Implementations
impl<'a, T: Clone, B: Clone + BlockDim> Clone for Block<'a, T, B>[src]
fn clone(&self) -> Block<'a, T, B>[src]
pub fn clone_from(&mut self, source: &Self)1.0.0[src]
impl<'a, T: Copy, B: Copy + BlockDim> Copy for Block<'a, T, B>[src]
impl<'a, T: Debug, B: Debug + BlockDim> Debug for Block<'a, T, B>[src]
impl<'a, T, B: BlockDim> Index<(usize, usize)> for Block<'a, T, B>[src]
Auto Trait Implementations
impl<'a, T, B> Send for Block<'a, T, B> where
B: Send,
T: Sync, [src]
B: Send,
T: Sync,
impl<'a, T, B> Sync for Block<'a, T, B> where
B: Sync,
T: Sync, [src]
B: Sync,
T: Sync,
impl<'a, T, B> Unpin for Block<'a, T, B> where
B: Unpin, [src]
B: Unpin,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T[src]
pub fn clone_into(&self, target: &mut T)[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
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]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,