Trait stride::StrideIndex[][src]

pub unsafe trait StrideIndex<T: ?Sized>: Sealed {
    type Output: ?Sized;
    fn get(self, stride: &T) -> Option<&Self::Output>;
fn get_mut(self, stride: &mut T) -> Option<&mut Self::Output>;
unsafe fn get_unchecked(self, stride: *const T) -> *const Self::Output;
unsafe fn get_unchecked_mut(self, stride: *mut T) -> *mut Self::Output;
fn index(self, stride: &T) -> &Self::Output;
fn index_mut(self, stride: &mut T) -> &mut Self::Output; }

A helper trait used for indexing operations.

This is the Stride version of SliceIndex. You should not use or implement this trait directly but instead use the corresponding methods on Stride.

Associated Types

type Output: ?Sized[src]

The output type returned by methods.

Loading content...

Required methods

fn get(self, stride: &T) -> Option<&Self::Output>[src]

Returns a shared reference to the output at this location, if in bounds.

fn get_mut(self, stride: &mut T) -> Option<&mut Self::Output>[src]

Returns a mutable reference to the output at this location, if in bounds.

unsafe fn get_unchecked(self, stride: *const T) -> *const Self::Output[src]

Returns a shared reference to the output at this location, without performing any bounds checking.

Safety

Calling this method with an out-of-bounds index or a dangling stride pointer is undefined behavior even if the resulting reference is not used.

unsafe fn get_unchecked_mut(self, stride: *mut T) -> *mut Self::Output[src]

Returns a mutable reference to the output at this location, without performing any bounds checking.

Safety

Calling this method with an out-of-bounds index or a dangling stride pointer is undefined behavior even if the resulting reference is not used.

fn index(self, stride: &T) -> &Self::Output[src]

Returns a shared reference to the output at this location, panicking if out of bounds.

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

Returns a mutable reference to the output at this location, panicking if out of bounds.

Loading content...

Implementations on Foreign Types

impl<T, const S: usize> StrideIndex<Stride<T, S>> for Range<usize>[src]

type Output = Stride<T, S>

impl<T, const S: usize> StrideIndex<Stride<T, S>> for RangeFrom<usize>[src]

type Output = Stride<T, S>

impl<T, const S: usize> StrideIndex<Stride<T, S>> for RangeFull[src]

type Output = Stride<T, S>

impl<T, const S: usize> StrideIndex<Stride<T, S>> for RangeInclusive<usize>[src]

type Output = Stride<T, S>

impl<T, const S: usize> StrideIndex<Stride<T, S>> for RangeTo<usize>[src]

type Output = Stride<T, S>

impl<T, const S: usize> StrideIndex<Stride<T, S>> for RangeToInclusive<usize>[src]

type Output = Stride<T, S>

Loading content...

Implementors

impl<T, const S: usize> StrideIndex<Stride<T, S>> for usize[src]

type Output = T

Loading content...