pub trait ArrayTrait {
    type Element;

    // Required methods
    fn get<I>(
        &self,
        i: I
    ) -> Option<&<I as SliceIndex<[Self::Element]>>::Output>
       where I: SliceIndex<[Self::Element]>;
    fn iter<'i>(&'i self) -> Box<dyn Iterator<Item = &Self::Element> + 'i>;
    fn len(&self) -> usize;

    // Provided method
    fn is_empty(&self) -> bool { ... }
}
Expand description

A trait for the minimal common functionality of a vale array

Required Associated Types§

source

type Element

Elements of the array

Required Methods§

source

fn get<I>(&self, i: I) -> Option<&<I as SliceIndex<[Self::Element]>>::Output>
where I: SliceIndex<[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.

source

fn iter<'i>(&'i self) -> Box<dyn Iterator<Item = &Self::Element> + 'i>

Iterates over the values paris

source

fn len(&self) -> usize

Number of key/value pairs

Provided Methods§

source

fn is_empty(&self) -> bool

Returns if the array is empty

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<T> Array for Vec<T>

§

type Element = T

source§

fn get<I>(&self, i: I) -> Option<&<I as SliceIndex<[T]>>::Output>
where I: SliceIndex<[T]>,

source§

fn iter<'i>(&'i self) -> Box<dyn Iterator<Item = &T> + 'i>

source§

fn len(&self) -> usize

Implementors§