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

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

A persistent list with structural sharing. This data structure supports fast push_front(), drop_first(), first(), and last().

Complexity

Let n be the number of elements in the list.

Temporal complexity

Operation Best case Average Worst case
new() Θ(1) Θ(1) Θ(1)
push_front() Θ(1) Θ(1) Θ(1)
drop_first() Θ(1) Θ(1) Θ(1)
reverse() Θ(n) Θ(n) Θ(n)
first() Θ(1) Θ(1) Θ(1)
last() Θ(1) Θ(1) Θ(1)
len() Θ(1) Θ(1) Θ(1)
clone() Θ(1) Θ(1) Θ(1)
iterator creation Θ(1) Θ(1) Θ(1)
iterator step Θ(1) Θ(1) Θ(1)
iterator full Θ(n) Θ(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]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

Trait Implementations

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

[src]

Serialize this value into the given Serde serializer. Read more

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

[src]

Deserialize this value from the given Serde deserializer. Read more

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

[src]

Formats the value using the given formatter.

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

[src]

Returns the "default value" for a type. Read more

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

[src]

This method tests for self and other values to be equal, and is used by ==. Read more

1.0.0
[src]

This method tests for !=.

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

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

[src]

This method returns an ordering between self and other values if one exists. Read more

1.0.0
[src]

This method tests less than (for self and other) and is used by the < operator. Read more

1.0.0
[src]

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

1.0.0
[src]

This method tests greater than (for self and other) and is used by the > operator. Read more

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

[src]

This method returns an Ordering between self and other. Read more

1.22.0
[src]

Compares and returns the maximum of two values. Read more

1.22.0
[src]

Compares and returns the minimum of two values. Read more

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

[src]

Feeds this value into the given [Hasher]. Read more

1.3.0
[src]

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

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

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

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

[src]

Formats the value using the given formatter. Read more

impl<'a, T> IntoIterator for &'a List<T>
[src]

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

[src]

Creates an iterator from a value. Read more

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

[src]

Creates a value from an iterator. Read more