Trait IndexMut

Source
pub trait IndexMut<T>: Index<T> {
    type OutputMut<'a>
       where Self: 'a;

    // Required method
    fn index_mut(&mut self, idx: T) -> Self::OutputMut<'_>;
}
Expand description

Index operator for mutable contexts. As opposed to std, the returned value can be a non-reference. This allows custom reference types for things like multi-dimensional matrices.

Required Associated Types§

Source

type OutputMut<'a> where Self: 'a

The output type of indexing this value

Required Methods§

Source

fn index_mut(&mut self, idx: T) -> Self::OutputMut<'_>

Get the value at this index mutably

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<T, I> IndexMut<I> for T
where T: IndexMut<I> + ?Sized, T::Output: 'static,

Source§

type OutputMut<'a> = &'a mut <T as Index<I>>::Output where Self: 'a