[][src]Struct rpds::list::List

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

A persistent list with structural sharing.

Complexity

Let n be the number of elements in the list.

Temporal complexity

Operation Average Worst case
new() Θ(1) Θ(1)
push_front() Θ(1) Θ(1)
drop_first() Θ(1) Θ(1)
reverse() Θ(n) Θ(n)
first() Θ(1) Θ(1)
last() Θ(1) Θ(1)
len() Θ(1) Θ(1)
clone() Θ(1) Θ(1)
iterator creation Θ(1) Θ(1)
iterator step Θ(1) Θ(1)
iterator full Θ(n) Θ(n)

Implementation details

This is your classic functional list with "cons" and "nil" nodes, with a little extra sauce to make some operations more efficient.

Methods

impl<T> List<T>[src]

#[must_use]
pub fn new() -> List<T>
[src]

#[must_use]
pub fn first(&self) -> Option<&T>
[src]

#[must_use]
pub fn last(&self) -> Option<&T>
[src]

#[must_use]
pub fn drop_first(&self) -> Option<List<T>>
[src]

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

#[must_use]
pub fn push_front(&self, v: T) -> List<T>
[src]

pub fn push_front_mut(&mut self, v: T)[src]

#[must_use]
pub fn reverse(&self) -> List<T>
[src]

pub fn reverse_mut(&mut self)[src]

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

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

#[must_use]
pub fn iter(&self) -> Iter<T>
[src]

Trait Implementations

impl<'a, T> IntoIterator for &'a List<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?

impl<T: Eq> Eq for List<T>[src]

impl<T> Clone for List<T>[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl<T: PartialOrd<T>> PartialOrd<List<T>> for List<T>[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: PartialEq> PartialEq<List<T>> for List<T>[src]

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests for !=.

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

impl<T: Ord> Ord for List<T>[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

impl<T: Hash> Hash for List<T>[src]

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0
[src]

Feeds a slice of this type into the given [Hasher]. Read more

impl<T> FromIterator<T> for List<T>[src]

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

impl<T: Display> Display for List<T>[src]

impl<T> Serialize for List<T> where
    T: Serialize
[src]

impl<'de, T> Deserialize<'de> for List<T> where
    T: Deserialize<'de>, 
[src]

Auto Trait Implementations

impl<T> Send for List<T> where
    T: Send + Sync

impl<T> Sync for List<T> where
    T: Send + Sync

Blanket Implementations

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

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

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

impl<T> From for T[src]

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

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

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

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

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

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]