Skip to main content

IndexedMut

Trait IndexedMut 

Source
pub trait IndexedMut<T> {
    type Element: ?Sized;

    // Required method
    fn get_mut(&mut self, i: T) -> Option<&mut Self::Element>;
}
Expand description

Trait for indexing into an array

Required Associated Types§

Source

type Element: ?Sized

Elements of the array

Required Methods§

Source

fn get_mut(&mut self, i: T) -> Option<&mut Self::Element>

Gets a ref to a value based on n index, returns None if the current Value isn’t an Array or doesn’t contain the index it was asked for.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl<T, I> IndexedMut<I> for Vec<T>
where I: SliceIndex<[T]>,

Source§

type Element = <I as SliceIndex<[T]>>::Output

Source§

fn get_mut(&mut self, i: I) -> Option<&mut <Vec<T> as IndexedMut<I>>::Element>

Implementors§