Trait Index

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

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

Index operator for immutable 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 Output<'a> where Self: 'a

The output type of indexing this value

Required Methods§

Source

fn index(&self, idx: T) -> Self::Output<'_>

Get the value at this index immutably

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

Source§

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