TiSliceIndex

Trait TiSliceIndex 

Source
pub trait TiSliceIndex<K, V>: Sealed<K> {
    type Output: ?Sized;

    // Required methods
    fn get(self, slice: &TiSlice<K, V>) -> Option<&Self::Output>;
    fn get_mut(self, slice: &mut TiSlice<K, V>) -> Option<&mut Self::Output>;
    unsafe fn get_unchecked(self, slice: &TiSlice<K, V>) -> &Self::Output;
    unsafe fn get_unchecked_mut(
        self,
        slice: &mut TiSlice<K, V>,
    ) -> &mut Self::Output;
    fn index(self, slice: &TiSlice<K, V>) -> &Self::Output;
    fn index_mut(self, slice: &mut TiSlice<K, V>) -> &mut Self::Output;
}
Expand description

A helper trait used for indexing operations.

This trait is implemented for K, Range<K>, RangeTo<K>, RangeFrom<K>, RangeInclusive<K> and RangeToInclusive<K>. The RangeFull<K> trait is not currently supported.

Trait implementations are only forwards to standard Rust slice operations.

Required Associated Types§

Source

type Output: ?Sized

The output type returned by methods.

Required Methods§

Source

fn get(self, slice: &TiSlice<K, V>) -> Option<&Self::Output>

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

Source

fn get_mut(self, slice: &mut TiSlice<K, V>) -> Option<&mut Self::Output>

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

Source

unsafe fn get_unchecked(self, slice: &TiSlice<K, V>) -> &Self::Output

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 is undefined behavior even if the resulting reference is not used.

Source

unsafe fn get_unchecked_mut( self, slice: &mut TiSlice<K, V>, ) -> &mut Self::Output

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 is undefined behavior even if the resulting reference is not used.

Source

fn index(self, slice: &TiSlice<K, V>) -> &Self::Output

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

Source

fn index_mut(self, slice: &mut TiSlice<K, V>) -> &mut Self::Output

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

Implementations on Foreign Types§

Source§

impl<K, V> TiSliceIndex<K, V> for (Bound<K>, Bound<K>)
where usize: From<K>,

Source§

type Output = TiSlice<K, V>

Source§

fn get(self, slice: &TiSlice<K, V>) -> Option<&Self::Output>

Source§

fn get_mut(self, slice: &mut TiSlice<K, V>) -> Option<&mut Self::Output>

Source§

unsafe fn get_unchecked(self, slice: &TiSlice<K, V>) -> &Self::Output

Source§

unsafe fn get_unchecked_mut( self, slice: &mut TiSlice<K, V>, ) -> &mut Self::Output

Source§

fn index(self, slice: &TiSlice<K, V>) -> &Self::Output

Source§

fn index_mut(self, slice: &mut TiSlice<K, V>) -> &mut Self::Output

Source§

impl<K, V> TiSliceIndex<K, V> for Range<K>
where usize: From<K>,

Source§

type Output = TiSlice<K, V>

Source§

fn get(self, slice: &TiSlice<K, V>) -> Option<&Self::Output>

Source§

fn get_mut(self, slice: &mut TiSlice<K, V>) -> Option<&mut Self::Output>

Source§

unsafe fn get_unchecked(self, slice: &TiSlice<K, V>) -> &Self::Output

Source§

unsafe fn get_unchecked_mut( self, slice: &mut TiSlice<K, V>, ) -> &mut Self::Output

Source§

fn index(self, slice: &TiSlice<K, V>) -> &Self::Output

Source§

fn index_mut(self, slice: &mut TiSlice<K, V>) -> &mut Self::Output

Source§

impl<K, V> TiSliceIndex<K, V> for RangeFrom<K>
where usize: From<K>,

Source§

type Output = TiSlice<K, V>

Source§

fn get(self, slice: &TiSlice<K, V>) -> Option<&Self::Output>

Source§

fn get_mut(self, slice: &mut TiSlice<K, V>) -> Option<&mut Self::Output>

Source§

unsafe fn get_unchecked(self, slice: &TiSlice<K, V>) -> &Self::Output

Source§

unsafe fn get_unchecked_mut( self, slice: &mut TiSlice<K, V>, ) -> &mut Self::Output

Source§

fn index(self, slice: &TiSlice<K, V>) -> &Self::Output

Source§

fn index_mut(self, slice: &mut TiSlice<K, V>) -> &mut Self::Output

Source§

impl<K, V> TiSliceIndex<K, V> for RangeInclusive<K>
where usize: From<K>,

Source§

type Output = TiSlice<K, V>

Source§

fn get(self, slice: &TiSlice<K, V>) -> Option<&Self::Output>

Source§

fn get_mut(self, slice: &mut TiSlice<K, V>) -> Option<&mut Self::Output>

Source§

unsafe fn get_unchecked(self, slice: &TiSlice<K, V>) -> &Self::Output

Source§

unsafe fn get_unchecked_mut( self, slice: &mut TiSlice<K, V>, ) -> &mut Self::Output

Source§

fn index(self, slice: &TiSlice<K, V>) -> &Self::Output

Source§

fn index_mut(self, slice: &mut TiSlice<K, V>) -> &mut Self::Output

Source§

impl<K, V> TiSliceIndex<K, V> for RangeTo<K>
where usize: From<K>,

Source§

type Output = TiSlice<K, V>

Source§

fn get(self, slice: &TiSlice<K, V>) -> Option<&Self::Output>

Source§

fn get_mut(self, slice: &mut TiSlice<K, V>) -> Option<&mut Self::Output>

Source§

unsafe fn get_unchecked(self, slice: &TiSlice<K, V>) -> &Self::Output

Source§

unsafe fn get_unchecked_mut( self, slice: &mut TiSlice<K, V>, ) -> &mut Self::Output

Source§

fn index(self, slice: &TiSlice<K, V>) -> &Self::Output

Source§

fn index_mut(self, slice: &mut TiSlice<K, V>) -> &mut Self::Output

Source§

impl<K, V> TiSliceIndex<K, V> for RangeToInclusive<K>
where usize: From<K>,

Source§

type Output = TiSlice<K, V>

Source§

fn get(self, slice: &TiSlice<K, V>) -> Option<&Self::Output>

Source§

fn get_mut(self, slice: &mut TiSlice<K, V>) -> Option<&mut Self::Output>

Source§

unsafe fn get_unchecked(self, slice: &TiSlice<K, V>) -> &Self::Output

Source§

unsafe fn get_unchecked_mut( self, slice: &mut TiSlice<K, V>, ) -> &mut Self::Output

Source§

fn index(self, slice: &TiSlice<K, V>) -> &Self::Output

Source§

fn index_mut(self, slice: &mut TiSlice<K, V>) -> &mut Self::Output

Implementors§

Source§

impl<K, V> TiSliceIndex<K, V> for K
where usize: From<K>,