Skip to main content

IndexExtension

Trait IndexExtension 

Source
pub trait IndexExtension<C>: Sized {
    // Provided methods
    fn get(self, collection: &C) -> Option<&C::Output>
       where C: Get<Self>,
             C::Output: Sized { ... }
    unsafe fn get_unchecked(self, collection: &C) -> &C::Output
       where C: Get<Self>,
             C::Output: Sized { ... }
    fn get_mut(self, collection: &mut C) -> Option<&C::Output>
       where C: GetMut<Self>,
             C::Output: Sized { ... }
    unsafe fn get_unchecked_mut(self, collection: &mut C) -> &mut C::Output
       where C: GetMut<Self>,
             C::Output: Sized { ... }
    fn is_valid(self, collection: &C) -> bool
       where C: Get<Self>,
             C::Output: Sized { ... }
    fn is_invalid(self, collection: &C) -> bool
       where C: Get<Self>,
             C::Output: Sized { ... }
    fn remove(self, collection: &mut C) -> Option<C::Output>
       where C: Remove<Self> { ... }
}

Provided Methods§

Source

fn get(self, collection: &C) -> Option<&C::Output>
where C: Get<Self>, C::Output: Sized,

Source

unsafe fn get_unchecked(self, collection: &C) -> &C::Output
where C: Get<Self>, C::Output: Sized,

Source

fn get_mut(self, collection: &mut C) -> Option<&C::Output>
where C: GetMut<Self>, C::Output: Sized,

Source

unsafe fn get_unchecked_mut(self, collection: &mut C) -> &mut C::Output
where C: GetMut<Self>, C::Output: Sized,

Source

fn is_valid(self, collection: &C) -> bool
where C: Get<Self>, C::Output: Sized,

Source

fn is_invalid(self, collection: &C) -> bool
where C: Get<Self>, C::Output: Sized,

Source

fn remove(self, collection: &mut C) -> Option<C::Output>
where C: Remove<Self>,

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<I, T> IndexExtension<T> for I
where I: SliceIndex<T>,