Struct linked_list::LinkedList
[−]
[src]
pub struct LinkedList<T> { /* fields omitted */ }
An experimental rewrite of LinkedList to provide a more cursor-oriented API.
Methods
impl<T> LinkedList<T>
[src]
fn new() -> LinkedList<T>
Makes a new LinkedList.
fn push_back(&mut self, elem: T)
Appends an element to the back of the list.
fn push_front(&mut self, elem: T)
Appends an element to the front of the list.
fn pop_back(&mut self) -> Option<T>
Removes the element at back of the list. Returns None if the list is empty.
fn pop_front(&mut self) -> Option<T>
Removes the element at front of the list. Returns None if the list is empty.
fn front(&self) -> Option<&T>
Gets the element at the front of the list, or None if empty.
fn back(&self) -> Option<&T>
Gets the element at the back of the list, or None if empty.
fn front_mut(&mut self) -> Option<&mut T>
Gets the element at the front of the list mutably, or None if empty.
fn back_mut(&mut self) -> Option<&mut T>
Gets the element at the back of the list mutably, or None if empty.
fn insert(&mut self, index: usize, elem: T)
Inserts an element at the given index.
Panics
Panics if the index is greater than the length of the list.
fn remove(&mut self, index: usize) -> Option<T>
Removes the element at the given index. Returns None if the index is out of bounds.
fn split_at(&mut self, index: usize) -> LinkedList<T>
Splits the list into two lists at the given index. Returns the right side of the split. Returns an empty list if index is out of bounds.
fn append(&mut self, other: &mut LinkedList<T>)
Appends the given list to the end of this one. The old list will be empty afterwards.
fn splice(&mut self, index: usize, other: &mut LinkedList<T>)
Inserts the given list at the given index. The old list will be empty afterwards.
fn len(&self) -> usize
Gets the number of elements in the list.
fn is_empty(&self) -> bool
Whether the list is empty.
fn clear(&mut self)
Removes all elements from the list.
fn cursor(&mut self) -> Cursor<T>
Gets a cursor over the list.
fn iter<'a>(&'a self) -> Iter<'a, T>
Provides a forward iterator.
fn iter_mut<'a>(&'a mut self) -> IterMut<'a, T>
Provides a forward iterator with mutable references.
fn into_iter(self) -> IntoIter<T>
Consumes the list into an iterator yielding elements by value.
Trait Implementations
impl<T> Drop for LinkedList<T>
[src]
impl<A> FromIterator<A> for LinkedList<A>
[src]
fn from_iter<T: IntoIterator<Item = A>>(iter: T) -> LinkedList<A>
Creates a value from an iterator. Read more
impl<A> Extend<A> for LinkedList<A>
[src]
fn extend<T: IntoIterator<Item = A>>(&mut self, iter: T)
Extends a collection with the contents of an iterator. Read more
impl<A: PartialEq> PartialEq for LinkedList<A>
[src]
fn eq(&self, other: &Self) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0
This method tests for !=
.
impl<A: Eq> Eq for LinkedList<A>
[src]
impl<A: PartialOrd> PartialOrd for LinkedList<A>
[src]
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &Rhs) -> bool
1.0.0
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Rhs) -> bool
1.0.0
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &Rhs) -> bool
1.0.0
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Rhs) -> bool
1.0.0
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl<A: Ord> Ord for LinkedList<A>
[src]
fn cmp(&self, other: &Self) -> Ordering
This method returns an Ordering
between self
and other
. Read more
impl<A: Debug> Debug for LinkedList<A>
[src]
impl<A: Hash> Hash for LinkedList<A>
[src]
fn hash<H: Hasher>(&self, state: &mut H)
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl<T: Clone> Clone for LinkedList<T>
[src]
fn clone(&self) -> LinkedList<T>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl<'a, T> IntoIterator for &'a LinkedList<T>
[src]
type Item = &'a T
The type of the elements being iterated over.
type IntoIter = Iter<'a, T>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Iter<'a, T>
Creates an iterator from a value. Read more
impl<'a, T> IntoIterator for &'a mut LinkedList<T>
[src]
type Item = &'a mut T
The type of the elements being iterated over.
type IntoIter = IterMut<'a, T>
Which kind of iterator are we turning this into?
fn into_iter(self) -> IterMut<'a, T>
Creates an iterator from a value. Read more