Struct index_list::IndexList[][src]

pub struct IndexList<T> { /* fields omitted */ }

Implementations

impl<T> IndexList<T>[src]

pub fn new() -> Self[src]

Creates a new empty index list.

pub fn capacity(&self) -> usize[src]

Returns the current capacity of the list.

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

Returns the number of valid elements in the list.

pub fn clear(&mut self)[src]

Clears the list be removing all elements, making it empty.

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

Returns true when the list is empty.

pub fn is_index_used(&self, index: Index) -> bool[src]

Returns true if the index is valid.

pub fn first_index(&self) -> Index[src]

Returns the index of the first element.

pub fn last_index(&self) -> Index[src]

Returns the index of the last element.

pub fn next_index(&self, index: Index) -> Index[src]

Returns the index of the next element, after index.

pub fn prev_index(&self, index: Index) -> Index[src]

Returns the index of the previous element, before index.

pub fn get_first(&self) -> Option<&T>[src]

Get a reference to the first element.

pub fn get_last(&self) -> Option<&T>[src]

Get a reference to the last element.

pub fn get(&self, index: Index) -> Option<&T>[src]

Get a reference to the element at the index.

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

Get a mutable reference to the first element.

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

Get a mutable reference to the last element.

pub fn get_mut(&mut self, index: Index) -> Option<&mut T>[src]

Get a mutable reference to the element at the index.

pub fn peek_next(&self, index: Index) -> Option<&T>[src]

Peek at next element, after index.

pub fn peek_prev(&self, index: Index) -> Option<&T>[src]

Peek at previous element, before index.

pub fn contains(&self, elem: T) -> bool where
    T: PartialEq
[src]

Returns true if the element exists.

pub fn insert_first(&mut self, elem: T) -> Index[src]

Insert a new element at the beginning.

pub fn insert_last(&mut self, elem: T) -> Index[src]

Insert a new element at the end.

pub fn insert_before(&mut self, index: Index, elem: T) -> Index[src]

Insert a new element before the index.

pub fn insert_after(&mut self, index: Index, elem: T) -> Index[src]

Insert a new element after the index.

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

Remove the first element.

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

Remove the last element.

pub fn remove(&mut self, index: Index) -> Option<T>[src]

Remove the element at the index.

pub fn iter(&self) -> Iter<'_, T>

Notable traits for Iter<'a, T>

impl<'a, T> Iterator for Iter<'a, T> type Item = &'a T;
[src]

Create a new iterator over all the element.

pub fn to_vec(&self) -> Vec<&T>[src]

Create a vector for all elements.

pub fn from(vec: &mut Vec<T>) -> IndexList<T>[src]

Insert all the elements from the vector, which will be drained.

pub fn trim_safe(&mut self)[src]

Remove any unused indexes at the end by truncating.

pub fn trim_swap(&mut self)[src]

Remove all unused elements by swapping indexes and then truncating. Note that this call may invalidate some indexes.

pub fn append(&mut self, other: &mut IndexList<T>)[src]

Add the elements of the other list at the end.

pub fn prepend(&mut self, other: &mut IndexList<T>)[src]

Add the elements of the other list at the beginning.

pub fn split(&mut self, index: Index) -> IndexList<T>[src]

Split the list by moving the elements from the index to a new list.

Trait Implementations

impl<T: Debug> Debug for IndexList<T>[src]

impl<T> Default for IndexList<T>[src]

impl<T> Display for IndexList<T> where
    T: Debug
[src]

impl<T> From<T> for IndexList<T>[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for IndexList<T> where
    T: RefUnwindSafe

impl<T> Send for IndexList<T> where
    T: Send

impl<T> Sync for IndexList<T> where
    T: Sync

impl<T> Unpin for IndexList<T> where
    T: Unpin

impl<T> UnwindSafe for IndexList<T> where
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<!> for T[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.