Skip to main content

TwoSidedIndex

Trait TwoSidedIndex 

Source
pub trait TwoSidedIndex<T>: Sized + Debug {
    type Output: ?Sized;

    // Required methods
    unsafe fn get_unchecked(self, target: &TwoSidedVec<T>) -> &Self::Output;
    unsafe fn get_unchecked_mut(
        self,
        target: &mut TwoSidedVec<T>,
    ) -> &mut Self::Output;
    fn check(&self, target: &TwoSidedVec<T>) -> bool;

    // Provided methods
    fn get(self, target: &TwoSidedVec<T>) -> Option<&Self::Output> { ... }
    fn get_mut(self, target: &mut TwoSidedVec<T>) -> Option<&mut Self::Output> { ... }
    fn index(self, target: &TwoSidedVec<T>) -> &Self::Output { ... }
    fn index_mut(self, target: &mut TwoSidedVec<T>) -> &mut Self::Output { ... }
    fn invalid(self) -> ! { ... }
}

Required Associated Types§

Required Methods§

Source

unsafe fn get_unchecked(self, target: &TwoSidedVec<T>) -> &Self::Output

Use this as an index against the specified vec

§Safety

Undefined behavior if the index is out of bounds

Source

unsafe fn get_unchecked_mut( self, target: &mut TwoSidedVec<T>, ) -> &mut Self::Output

Use this as an index against the specified vec

§Safety

Undefined behavior if the index is out of bounds

Source

fn check(&self, target: &TwoSidedVec<T>) -> bool

Provided Methods§

Source

fn get(self, target: &TwoSidedVec<T>) -> Option<&Self::Output>

Source

fn get_mut(self, target: &mut TwoSidedVec<T>) -> Option<&mut Self::Output>

Source

fn index(self, target: &TwoSidedVec<T>) -> &Self::Output

Source

fn index_mut(self, target: &mut TwoSidedVec<T>) -> &mut Self::Output

Source

fn invalid(self) -> !

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T> TwoSidedIndex<T> for Range<isize>

Source§

type Output = [T]

Source§

unsafe fn get_unchecked(self, target: &TwoSidedVec<T>) -> &Self::Output

Source§

unsafe fn get_unchecked_mut( self, target: &mut TwoSidedVec<T>, ) -> &mut Self::Output

Source§

fn check(&self, target: &TwoSidedVec<T>) -> bool

Source§

impl<T> TwoSidedIndex<T> for RangeFrom<isize>

Source§

type Output = [T]

Source§

unsafe fn get_unchecked(self, target: &TwoSidedVec<T>) -> &Self::Output

Source§

unsafe fn get_unchecked_mut( self, target: &mut TwoSidedVec<T>, ) -> &mut Self::Output

Source§

fn check(&self, target: &TwoSidedVec<T>) -> bool

Source§

impl<T> TwoSidedIndex<T> for RangeFull

Source§

type Output = [T]

Source§

unsafe fn get_unchecked(self, target: &TwoSidedVec<T>) -> &Self::Output

Source§

unsafe fn get_unchecked_mut( self, target: &mut TwoSidedVec<T>, ) -> &mut Self::Output

Source§

fn check(&self, _target: &TwoSidedVec<T>) -> bool

Source§

impl<T> TwoSidedIndex<T> for RangeTo<isize>

Source§

type Output = [T]

Source§

unsafe fn get_unchecked(self, target: &TwoSidedVec<T>) -> &Self::Output

Source§

unsafe fn get_unchecked_mut( self, target: &mut TwoSidedVec<T>, ) -> &mut Self::Output

Source§

fn check(&self, target: &TwoSidedVec<T>) -> bool

Source§

impl<T> TwoSidedIndex<T> for isize

Source§

type Output = T

Source§

unsafe fn get_unchecked(self, target: &TwoSidedVec<T>) -> &Self::Output

Source§

unsafe fn get_unchecked_mut( self, target: &mut TwoSidedVec<T>, ) -> &mut Self::Output

Source§

fn check(&self, target: &TwoSidedVec<T>) -> bool

Implementors§