[−][src]Struct fwdlist::List
A simply linked list.
Methods
impl<T> List<T>
[src]
pub fn cursor(&mut self) -> Cursor<T>
[src]
Return a cursor at the beginning of the list (before the first node).
impl<T> List<T>
[src]
ⓘImportant traits for ListIter<'a, T>pub fn iter(&self) -> ListIter<T>
[src]
Returns an iterator over the list yielding read-only references.
impl<T> List<T>
[src]
ⓘImportant traits for ListIterMut<'a, T>pub fn iter_mut(&mut self) -> ListIterMut<T>
[src]
Returns an iterator over the list yielding mutable references.
impl<T> List<T>
[src]
Some accessors to front/back elements.
pub fn front(&self) -> Option<&T>
[src]
Returns a reference to the first element in the list.
pub fn front_mut(&mut self) -> Option<&mut T>
[src]
Returns a mutable reference to the first element in the list.
pub fn back(&self) -> Option<&T>
[src]
Returns a reference to the last element in the list.
pub fn back_mut(&mut self) -> Option<&mut T>
[src]
Returns a mutable reference to the last element in the list.
impl<T> List<T>
[src]
pub fn new() -> List<T>
[src]
A new empty list.
pub fn len(&self) -> usize
[src]
The size of the list in O(1).
pub fn is_empty(&self) -> bool
[src]
Returns true if list is empty in O(1);
pub fn push_front(&mut self, v: T)
[src]
Push a new element at the front of the list in O(1). Cannot fails, only panic!/OOM on memory exhaustion.
pub fn pop_front(&mut self) -> Option<T>
[src]
Pop a element from the front of the list in O(1). Returns None if the list is empty.
pub fn push_back(&mut self, v: T)
[src]
Push an element at the end of the list in O(n). Cannot fails, only panic!/OOM on memory exhaustion.
pub fn pop_back(&mut self) -> Option<T>
[src]
Pop an element from the end of the list in O(n). Returns None if the list is empty.
pub fn clear(&mut self)
[src]
Clear the list in O(n).
impl<T> List<T>
[src]
Extra operations on the list - Unstable API.
pub fn append(&mut self, other: &mut List<T>)
[src]
Moves all elements from other
to the end of the list in O(self.len());
pub fn split_off(&mut self, at: usize) -> List<T>
[src]
Splits the list into two at the given index in O(at).
- Returns everything after the given index, including the index.
- if
at == self.len()
, returns an empty list in O(1). - Panics if
at > self.len()
.
Trait Implementations
impl<A: Ord> Ord for List<A>
[src]
fn cmp(&self, other: &List<A>) -> Ordering
[src]
fn max(self, other: Self) -> Self
1.21.0[src]
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
Compares and returns the minimum of two values. Read more
fn clamp(self, min: Self, max: Self) -> Self
[src]
clamp
)Returns max if self is greater than max, and min if self is less than min. Otherwise this will return self. Panics if min > max. Read more
impl<T> Drop for List<T>
[src]
Drop the list in O(n).
impl<T> IntoIterator for List<T>
[src]
for v in my_list { v ... }
type Item = T
The type of the elements being iterated over.
type IntoIter = ListIntoIter<Self::Item>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
impl<'a, T> IntoIterator for &'a List<T>
[src]
for v in &my_list { *v ... }
type Item = &'a T
The type of the elements being iterated over.
type IntoIter = ListIter<'a, T>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
impl<'a, T> IntoIterator for &'a mut List<T>
[src]
for v in &mut my_list { *v = ... }
type Item = &'a mut T
The type of the elements being iterated over.
type IntoIter = ListIterMut<'a, T>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
impl<T> Extend<T> for List<T>
[src]
Extend the list from the content of iter
in O(n).
fn extend<I>(&mut self, iter: I) where
I: IntoIterator<Item = T>,
[src]
I: IntoIterator<Item = T>,
impl<A: Eq> Eq for List<A>
[src]
impl<A: PartialOrd> PartialOrd<List<A>> for List<A>
[src]
fn partial_cmp(&self, other: &List<A>) -> Option<Ordering>
[src]
#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests less than (for self
and other
) and is used by the <
operator. Read more
#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl<T> Default for List<T>
[src]
A default empty list.
impl<A: PartialEq> PartialEq<List<A>> for List<A>
[src]
fn eq(&self, other: &List<A>) -> bool
[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl<T: Clone> Clone for List<T>
[src]
Clone a list in O(n).
clone_from()
will reuse as many nodes from self
as possible to avoid
reallocation.
impl<T: Debug> Debug for List<T>
[src]
A debug formatter.
impl<T: Hash> Hash for List<T>
[src]
fn hash<H: Hasher>(&self, state: &mut H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl<T> FromIterator<T> for List<T>
[src]
Construct a list from the content of the iterator iter
in O(n).
fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> List<T>
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> From for T
[src]
impl<I> IntoIterator for I where
I: Iterator,
[src]
I: Iterator,
type Item = <I as Iterator>::Item
The type of the elements being iterated over.
type IntoIter = I
Which kind of iterator are we turning this into?
fn into_iter(self) -> I
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,