Trait value_trait::Array[][src]

pub trait Array: Index<usize> + Sync + Send + Clone {
    type Element: Value;
    #[must_use]
    fn get<I>(
        &self,
        i: I
    ) -> Option<&<I as SliceIndex<[Self::Element]>>::Output>
    where
        I: SliceIndex<[Self::Element]>
;
#[must_use] fn get_mut(&mut self, i: usize) -> Option<&mut Self::Element>;
#[must_use] fn pop(&mut self) -> Option<Self::Element>;
fn push(&mut self, e: Self::Element);
#[must_use] fn iter<'i>(&'i self) -> Box<dyn Iterator<Item = &Self::Element> + 'i>;
#[must_use] fn len(&self) -> usize; #[must_use] fn is_empty(&self) -> bool { ... } }
Expand description

Functions guaranteed for any array object

Associated Types

type Element: Value[src]

Elements of the array

Required methods

#[must_use]
fn get<I>(&self, i: I) -> Option<&<I as SliceIndex<[Self::Element]>>::Output> where
    I: SliceIndex<[Self::Element]>, 
[src]

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.

#[must_use]
fn get_mut(&mut self, i: usize) -> Option<&mut Self::Element>
[src]

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.

#[must_use]
fn pop(&mut self) -> Option<Self::Element>
[src]

Returns the last element of the array or None

fn push(&mut self, e: Self::Element)[src]

Appends e to the end of the Array

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

Iterates over the values paris

#[must_use]
fn len(&self) -> usize
[src]

Number of key/value pairs

Provided methods

#[must_use]
fn is_empty(&self) -> bool
[src]

Returns if the array is empty

Implementations on Foreign Types

impl<T> Array for Vec<T> where
    T: Value + Sync + Send + Clone
[src]

type Element = T

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

fn get_mut(&mut self, i: usize) -> Option<&mut T>[src]

fn pop(&mut self) -> Option<T>[src]

fn push(&mut self, e: T)[src]

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

fn len(&self) -> usize[src]

Implementors