Struct rpds::map::red_black_tree_map::RedBlackTreeMap [] [src]

pub struct RedBlackTreeMap<K, V> { /* fields omitted */ }

A persistent map with structural sharing. This implementation uses a red-black tree and supports fast insert(), remove(), and get().

Complexity

Let n be the number of elements in the map.

Temporal complexity

Operation Best case Average Worst case
new() Θ(1) Θ(1) Θ(1)
insert() Θ(1) Θ(log(n)) Θ(log(n))
remove() Θ(1) Θ(log(n)) Θ(log(n))
get() Θ(1) Θ(log(n)) Θ(log(n))
contains_key() Θ(1) Θ(log(n)) Θ(log(n))
size() Θ(1) Θ(1) Θ(1)
clone() Θ(1) Θ(1) Θ(1)
iterator creation Θ(1) Θ(1) Θ(1)
iterator step Θ(1) Θ(1) Θ(log(n))
iterator full Θ(n) Θ(n) Θ(n)

Implementation details

This implementation uses a red-black tree as described in "Purely Functional Data Structures" by Chris Okasaki, page 27. Deletion is implemented according to the paper "Red-Black Trees with Types" by Stefan Kahrs (reference implementation)

Methods

impl<K, V> RedBlackTreeMap<K, V> where
    K: Ord
[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

Trait Implementations

impl<K, V> Serialize for RedBlackTreeMap<K, V> where
    K: Ord + Serialize,
    V: Serialize
[src]

[src]

Serialize this value into the given Serde serializer. Read more

impl<'de, K, V> Deserialize<'de> for RedBlackTreeMap<K, V> where
    K: Ord + Deserialize<'de>,
    V: Deserialize<'de>, 
[src]

[src]

Deserialize this value from the given Serde deserializer. Read more

impl<K: Debug, V: Debug> Debug for RedBlackTreeMap<K, V>
[src]

[src]

Formats the value using the given formatter. Read more

impl<'a, K, Q: ?Sized, V> Index<&'a Q> for RedBlackTreeMap<K, V> where
    K: Ord + Borrow<Q>,
    Q: Ord
[src]

The returned type after indexing.

[src]

Performs the indexing (container[index]) operation.

impl<K, V> Clone for RedBlackTreeMap<K, V> where
    K: Ord
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl<K, V> Default for RedBlackTreeMap<K, V> where
    K: Ord
[src]

[src]

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

impl<K, V: PartialEq> PartialEq for RedBlackTreeMap<K, V> where
    K: Ord
[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<K, V: Eq> Eq for RedBlackTreeMap<K, V> where
    K: Ord
[src]

impl<K: Ord, V: PartialOrd> PartialOrd for RedBlackTreeMap<K, V>
[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<K: Ord, V: Ord> Ord for RedBlackTreeMap<K, V>
[src]

[src]

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

1.21.0
[src]

Compares and returns the maximum of two values. Read more

1.21.0
[src]

Compares and returns the minimum of two values. Read more

impl<K: Hash, V: Hash> Hash for RedBlackTreeMap<K, V> where
    K: Ord
[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<K, V> Display for RedBlackTreeMap<K, V> where
    K: Ord + Display,
    V: Display
[src]

[src]

Formats the value using the given formatter. Read more

impl<'a, K, V> IntoIterator for &'a RedBlackTreeMap<K, V> where
    K: Ord
[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<K, V> FromIterator<(K, V)> for RedBlackTreeMap<K, V> where
    K: Ord
[src]

[src]

Creates a value from an iterator. Read more

Auto Trait Implementations

impl<K, V> Send for RedBlackTreeMap<K, V> where
    K: Send + Sync,
    V: Send + Sync

impl<K, V> Sync for RedBlackTreeMap<K, V> where
    K: Send + Sync,
    V: Send + Sync