Trait typed_index_collections::TiSliceIndex[][src]

pub trait TiSliceIndex<K, V>: Sealed<K> {
    type Output: ?Sized;
    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.

Associated Types

type Output: ?Sized[src]

The output type returned by methods.

Required methods

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

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

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

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

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

Returns a shared reference to the output at this location, without performing any bounds checking. Calling this method with an out-of-bounds index is undefined behavior even if the resulting reference is not used.

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

Returns a mutable reference to the output at this location, without performing any bounds checking. Calling this method with an out-of-bounds index is undefined behavior even if the resulting reference is not used.

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

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

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

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

Implementations on Foreign Types

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

type Output = TiSlice<K, V>

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

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

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

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

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

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

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

type Output = TiSlice<K, V>

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

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

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

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

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

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

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

type Output = TiSlice<K, V>

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

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

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

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

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

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

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

type Output = TiSlice<K, V>

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

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

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

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

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

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

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

type Output = TiSlice<K, V>

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

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

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

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

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

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

Implementors

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

type Output = V

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

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

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

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

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

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