Array

Trait Array 

Source
pub trait Array {
    type Item;

    // Required methods
    fn len(&self) -> usize;
    fn get(&self, ind: usize) -> &Self::Item;
    fn set(&mut self, ind: usize, val: Self::Item);
    fn push(&mut self, val: Self::Item);
}
Expand description

Implemented by array types.

Required Associated Types§

Source

type Item

The type of item.

Required Methods§

Source

fn len(&self) -> usize

Returns the number of items.

Source

fn get(&self, ind: usize) -> &Self::Item

Get value of item by index.

Source

fn set(&mut self, ind: usize, val: Self::Item)

Set value of item at index.

Source

fn push(&mut self, val: Self::Item)

Push new item at the end of array.

Implementations on Foreign Types§

Source§

impl<T> Array for Vec<T>

Source§

type Item = T

Source§

fn len(&self) -> usize

Source§

fn get(&self, ind: usize) -> &T

Source§

fn set(&mut self, ind: usize, val: T)

Source§

fn push(&mut self, val: T)

Implementors§