value_trait::prelude

Trait Indexed

source
pub trait Indexed<T> {
    type Element: ?Sized;

    // Required method
    fn get(&self, i: T) -> Option<&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(&self, i: T) -> Option<&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.

Implementations on Foreign Types§

source§

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

source§

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

source§

fn get(&self, i: I) -> Option<&Self::Element>

Implementors§