[][src]Struct rpds::map::hash_trie_map::HashTrieMap

pub struct HashTrieMap<K, V, H: BuildHasher = RandomState> { /* fields omitted */ }

A persistent map with structural sharing. This implementation uses a hash array mapped trie.

Complexity

Let n be the number of elements in the map.

Temporal complexity

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

Implementation details

This implementation uses a hash array mapped trie. Details can be found in Ideal Hash Trees.

See the Node documentation for details.

Methods

impl<K, V> HashTrieMap<K, V, RandomState> where
    K: Eq + Hash
[src]

#[must_use]
pub fn new() -> HashTrieMap<K, V>
[src]

#[must_use]
pub fn new_with_degree(degree: u8) -> HashTrieMap<K, V>
[src]

impl<K, V, H: BuildHasher> HashTrieMap<K, V, H> where
    K: Eq + Hash,
    H: Clone
[src]

#[must_use]
pub fn new_with_hasher(hasher_builder: H) -> HashTrieMap<K, V, H>
[src]

#[must_use]
pub fn new_with_hasher_and_degree(
    hasher_builder: H,
    degree: u8
) -> HashTrieMap<K, V, H>
[src]

#[must_use]
pub fn get<Q: ?Sized>(&self, key: &Q) -> Option<&V> where
    K: Borrow<Q>,
    Q: Hash + Eq
[src]

#[must_use]
pub fn insert(&self, key: K, value: V) -> HashTrieMap<K, V, H>
[src]

pub fn insert_mut(&mut self, key: K, value: V)[src]

#[must_use]
pub fn remove<Q: ?Sized>(&self, key: &Q) -> HashTrieMap<K, V, H> where
    K: Borrow<Q>,
    Q: Hash + Eq
[src]

pub fn remove_mut<Q: ?Sized>(&mut self, key: &Q) -> bool where
    K: Borrow<Q>,
    Q: Hash + Eq
[src]

#[must_use]
pub fn contains_key<Q: ?Sized>(&self, key: &Q) -> bool where
    K: Borrow<Q>,
    Q: Hash + Eq
[src]

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

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

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

#[must_use]
pub fn keys(&self) -> IterKeys<K, V>
[src]

#[must_use]
pub fn values(&self) -> IterValues<K, V>
[src]

Trait Implementations

impl<K, V, H: BuildHasher> Default for HashTrieMap<K, V, H> where
    K: Eq + Hash,
    H: Default + Clone
[src]

impl<K: Eq, V: PartialEq, H: BuildHasher> PartialEq<HashTrieMap<K, V, H>> for HashTrieMap<K, V, H> where
    K: Hash,
    H: Clone
[src]

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

This method tests for !=.

impl<K: Eq, V: Eq, H: BuildHasher> Eq for HashTrieMap<K, V, H> where
    K: Hash,
    H: Clone
[src]

impl<K, V, H: BuildHasher> Clone for HashTrieMap<K, V, H> where
    K: Eq + Hash,
    H: Clone
[src]

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

Performs copy-assignment from source. Read more

impl<'a, K, V, H: BuildHasher> IntoIterator for &'a HashTrieMap<K, V, H> where
    K: Eq + Hash,
    H: Default + Clone
[src]

type Item = (&'a K, &'a V)

The type of the elements being iterated over.

type IntoIter = Iter<'a, K, V>

Which kind of iterator are we turning this into?

impl<K: Debug, V: Debug, H: Debug + BuildHasher> Debug for HashTrieMap<K, V, H>[src]

impl<K, V, H: BuildHasher> Display for HashTrieMap<K, V, H> where
    K: Eq + Hash + Display,
    V: Display,
    H: Clone
[src]

impl<'a, K, Q: ?Sized, V, H: BuildHasher> Index<&'a Q> for HashTrieMap<K, V, H> where
    K: Eq + Hash + Borrow<Q>,
    Q: Hash + Eq,
    H: Clone
[src]

type Output = V

The returned type after indexing.

impl<K, V, H> FromIterator<(K, V)> for HashTrieMap<K, V, H> where
    K: Eq + Hash,
    H: BuildHasher + Clone + Default
[src]

impl<K, V, H> Serialize for HashTrieMap<K, V, H> where
    K: Eq + Hash + Serialize,
    V: Serialize,
    H: BuildHasher + Clone + Default
[src]

impl<'de, K, V, H> Deserialize<'de> for HashTrieMap<K, V, H> where
    K: Eq + Hash + Deserialize<'de>,
    V: Deserialize<'de>,
    H: BuildHasher + Clone + Default
[src]

Auto Trait Implementations

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

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

Blanket Implementations

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

impl<T> From for 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, 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> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut 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> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]