Struct std::collections::DList[src]

pub struct DList<T> {
    // some fields omitted
}

A doubly-linked list.

Methods

impl<T> DList<T>

fn new<T>() -> DList<T>

Create an empty DList

fn rotate_forward<T>(&mut self)

Move the last element to the front of the list.

If the list is empty, do nothing.

fn rotate_backward<T>(&mut self)

Move the first element to the back of the list.

If the list is empty, do nothing.

fn append<T>(&mut self, other: DList<T>)

Add all elements from other to the end of the list

O(1)

fn prepend<T>(&mut self, other: DList<T>)

Add all elements from other to the beginning of the list

O(1)

fn insert_when<T>(&mut self, elt: T, f: |&T, &T| -> bool)

Insert elt before the first x in the list where f(x, elt) is true, or at the end.

O(N)

fn merge<T>(&mut self, other: DList<T>, f: |&T, &T| -> bool)

Merge DList other into this DList, using the function f. Iterate the both DList with a from self and b from other, and put a in the result if f(a, b) is true, else b.

O(max(N, M))

fn iter<T>(&'a self) -> Items<'a, T>

Provide a forward iterator

fn mut_iter<T>(&'a mut self) -> MutItems<'a, T>

Provide a forward iterator with mutable references

fn move_iter<T>(self) -> MoveItems<T>

Consume the list into an iterator yielding elements by value

impl<T: Ord> DList<T>

fn insert_ordered<T: Ord>(&mut self, elt: T)

Insert elt sorted in ascending order

O(N)

Trait Implementations

impl<T> Collection for DList<T>

fn is_empty<T>(&self) -> bool

O(1)

fn len<T>(&self) -> uint

O(1)

fn is_empty<T>(&self) -> bool

impl<T> Mutable for DList<T>

fn clear<T>(&mut self)

Remove all elements from the DList

O(N)

impl<T> Deque<T> for DList<T>

fn front<T>(&'a self) -> Option<&'a T>

Provide a reference to the front element, or None if the list is empty

fn front_mut<T>(&'a mut self) -> Option<&'a mut T>

Provide a mutable reference to the front element, or None if the list is empty

fn back<T>(&'a self) -> Option<&'a T>

Provide a reference to the back element, or None if the list is empty

fn back_mut<T>(&'a mut self) -> Option<&'a mut T>

Provide a mutable reference to the back element, or None if the list is empty

fn push_front<T>(&mut self, elt: T)

Add an element first in the list

O(1)

fn pop_front<T>(&mut self) -> Option<T>

Remove the first element and return it, or None if the list is empty

O(1)

fn push_back<T>(&mut self, elt: T)

Add an element last in the list

O(1)

fn pop_back<T>(&mut self) -> Option<T>

Remove the last element and return it, or None if the list is empty

O(1)

impl<T> Default for DList<T>

fn default<T>() -> DList<T>

impl<T> Drop for DList<T>

fn drop<T>(&mut self)

impl<A> FromIterator<A> for DList<A>

fn from_iter<T: Iterator<A>>(iterator: T) -> DList<A>

impl<A> Extendable<A> for DList<A>

fn extend<T: Iterator<A>>(&mut self, iterator: T)

impl<A: PartialEq> PartialEq for DList<A>

fn eq<A: PartialEq>(&self, other: &DList<A>) -> bool

fn ne<A: PartialEq>(&self, other: &DList<A>) -> bool

fn ne<A: PartialEq>(&self, &DList<A>) -> bool

impl<A: PartialOrd> PartialOrd for DList<A>

fn lt<A: PartialOrd>(&self, other: &DList<A>) -> bool

fn le<A: PartialOrd>(&self, other: &DList<A>) -> bool

fn gt<A: PartialOrd>(&self, other: &DList<A>) -> bool

fn ge<A: PartialOrd>(&self, other: &DList<A>) -> bool

fn le<A: PartialOrd>(&self, &DList<A>) -> bool

fn gt<A: PartialOrd>(&self, &DList<A>) -> bool

fn ge<A: PartialOrd>(&self, &DList<A>) -> bool

impl<A: Clone> Clone for DList<A>

fn clone<A: Clone>(&self) -> DList<A>

fn clone_from<A: Clone>(&mut self, &DList<A>)

impl<A: Show> Show for DList<A>

fn fmt<A: Show>(&self, f: &mut Formatter) -> Result<(), FormatError>