Trait Entriable

Source
pub trait Entriable: IndexMut<usize, Output = Self::T> {
    type T;

    // Required methods
    fn len(&self) -> usize;
    fn insert(&mut self, index: usize, value: Self::T);
    fn remove(&mut self, index: usize) -> Self::T;
}

Required Associated Types§

Source

type T

Required Methods§

Source

fn len(&self) -> usize

Returns the number of elements in the container.

Source

fn insert(&mut self, index: usize, value: Self::T)

Inserts an element at index within the container, shifting all elements with indices greater than or equal to index towards the back.

Element at index 0 is the front.

§Panics

Panics if index is greater than container’s length

Source

fn remove(&mut self, index: usize) -> Self::T

Removes and returns the element at index from the container, shifting all elements with indices greater than or equal to index towards the front.

Element at index 0 is the front of the container.

§Panics

Panics if index is out of bounds.

Implementations on Foreign Types§

Source§

impl<T> Entriable for VecDeque<T>

Source§

type T = T

Source§

fn len(&self) -> usize

Source§

fn insert(&mut self, index: usize, value: T)

Source§

fn remove(&mut self, index: usize) -> T

Source§

impl<T> Entriable for Vec<T>

Source§

type T = T

Source§

fn len(&self) -> usize

Source§

fn insert(&mut self, index: usize, value: T)

Source§

fn remove(&mut self, index: usize) -> T

Implementors§