Trait ArrayIndex

Source
pub trait ArrayIndex<O: Object> {
    type Output;

    // Required methods
    fn get(self, array: Array<O>) -> Option<Self::Output>;
    unsafe fn get_unchecked(self, array: Array<O>) -> Self::Output;
}
Expand description

A type that can be used to index into an Array.

Required Associated Types§

Source

type Output

The output returned from indexing.

Required Methods§

Source

fn get(self, array: Array<O>) -> Option<Self::Output>

Returns the output at self, or None if self is out-of-bounds.

Source

unsafe fn get_unchecked(self, array: Array<O>) -> Self::Output

Returns the output at self without safety checks.

Implementations on Foreign Types§

Source§

impl<O: Object> ArrayIndex<O> for usize

Source§

type Output = O

Source§

fn get(self, array: Array<O>) -> Option<Self::Output>

Source§

unsafe fn get_unchecked(self, array: Array<O>) -> Self::Output

Source§

impl<O: Object> ArrayIndex<O> for Range<usize>

Source§

type Output = Array<O>

Source§

fn get(self, array: Array<O>) -> Option<Self::Output>

Source§

unsafe fn get_unchecked(self, array: Array<O>) -> Self::Output

Implementors§