Trait eclectic::list::List [] [src]

pub trait List: Collection {
    fn get(&self, index: usize) -> Option<&Self::Item>;
    fn get_mut(&mut self, index: usize) -> Option<&mut Self::Item>;
    fn iter<'a>(&'a self) -> Box<Iterator<Item=&'a Self::Item> + 'a>;
    fn iter_mut<'a>(&'a mut self) -> Box<Iterator<Item=&'a mut Self::Item> + 'a>;
    fn swap(&mut self, i: usize, j: usize);
}

A list.

Required Methods

fn get(&self, index: usize) -> Option<&Self::Item>

Returns a reference to the item at the given index in the list.

Returns None if index >= self.len().

fn get_mut(&mut self, index: usize) -> Option<&mut Self::Item>

Returns a mutable reference to the item at the given index in the list.

Returns None if index >= self.len().

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

Returns an iterator that yields references to the list's items.

The iteration order is the order of the items in the list.

fn iter_mut<'a>(&'a mut self) -> Box<Iterator<Item=&'a mut Self::Item> + 'a>

Returns an iterator that yields mutable references to the list's items.

The iteration order is the order of the items in the list.

fn swap(&mut self, i: usize, j: usize)

Swaps the items at the given indices in the list.

Panics

Panics if i >= self.len() || j >= self.len().

Implementors