Struct weak_table::WeakValueHashMap [] [src]

pub struct WeakValueHashMap<K, V, S = RandomState> { /* fields omitted */ }

A hash map with weak values.

When a weak pointer expires, its mapping is lazily removed.

Methods

impl<K: Eq + Hash, V: WeakElement> WeakValueHashMap<K, V, RandomState>
[src]

[src]

Creates an empty WeakValueHashMap.

[src]

Creates an empty WeakValueHashMap with the given capacity.

impl<K: Eq + Hash, V: WeakElement, S: BuildHasher> WeakValueHashMap<K, V, S>
[src]

[src]

Creates an empty WeakValueHashMap with the given capacity and hasher.

[src]

Creates an empty WeakValueHashMap with the given capacity and hasher.

[src]

Returns a reference to the map's BuildHasher.

[src]

Returns the number of elements the map can hold without reallocating.

[src]

Removes all mappings whose keys have expired.

[src]

Reserves room for additional elements.

[src]

Shrinks the capacity to the minimum allowed to hold the current number of elements.

[src]

Returns an over-approximation of the number of elements.

[src]

Is the map empty?

Note that this may return false even if all keys in the map have expired, if they haven't been collected yet.

[src]

The proportion of buckets that are used.

This is an over-approximation because of expired keys.

[src]

Gets the requested entry.

[src]

Removes all associations from the map.

[src]

Returns a reference to the value corresponding to the key.

[src]

Returns true if the map contains the specified key.

[src]

Unconditionally inserts the value, returning the old value if already present.

Like std::collections::HashMap, this does not replace the key if occupied.

[src]

Removes the entry with the given key, if it exists, and returns the value.

[src]

Removes all mappings not satisfying the given predicate.

Also removes any expired mappings.

[src]

Is this map a submap of the other, using the given value comparison.

In particular, all the keys of self must be in other and the values must compare true with value_equal.

[src]

Is self a submap of other?

[src]

Are the keys of self a subset of the keys of other?

impl<K, V: WeakElement, S> WeakValueHashMap<K, V, S>
[src]

Important traits for Iter<'a, K, V>
[src]

Gets an iterator over the keys and values.

Important traits for Keys<'a, K, V>
[src]

Gets an iterator over the keys.

Important traits for Values<'a, K, V>
[src]

Gets an iterator over the values.

Important traits for Drain<'a, K, V>
[src]

Gets a draining iterator, which removes all the values but retains the storage.

Trait Implementations

impl<K, V, V1, S, S1> PartialEq<WeakValueHashMap<K, V1, S1>> for WeakValueHashMap<K, V, S> where
    K: Eq + Hash,
    V: WeakElement,
    V1: WeakElement,
    V::Strong: PartialEq<V1::Strong>,
    S: BuildHasher,
    S1: BuildHasher
[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: Eq + Hash, V: WeakElement, S: BuildHasher> Eq for WeakValueHashMap<K, V, S> where
    V::Strong: Eq
[src]

impl<K: Eq + Hash, V: WeakElement, S: BuildHasher + Default> Default for WeakValueHashMap<K, V, S>
[src]

[src]

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

impl<K, V, S> FromIterator<(K, V::Strong)> for WeakValueHashMap<K, V, S> where
    K: Eq + Hash,
    V: WeakElement,
    S: BuildHasher + Default
[src]

[src]

Creates a value from an iterator. Read more

impl<K, V, S> Extend<(K, V::Strong)> for WeakValueHashMap<K, V, S> where
    K: Eq + Hash,
    V: WeakElement,
    S: BuildHasher
[src]

[src]

Extends a collection with the contents of an iterator. Read more

impl<'a, K, V, S> Extend<(&'a K, &'a V::Strong)> for WeakValueHashMap<K, V, S> where
    K: 'a + Eq + Hash + Clone,
    V: 'a + WeakElement,
    V::Strong: Clone,
    S: BuildHasher
[src]

[src]

Extends a collection with the contents of an iterator. Read more

impl<K: Debug, V: WeakElement, S> Debug for WeakValueHashMap<K, V, S> where
    V::Strong: Debug
[src]

[src]

Formats the value using the given formatter. Read more

impl<K, V: WeakElement, S> IntoIterator for WeakValueHashMap<K, V, S>
[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<'a, K, V: WeakElement, S> IntoIterator for &'a WeakValueHashMap<K, V, S>
[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: Clone, V: Clone, S: Clone> Clone for WeakValueHashMap<K, V, S>
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

Auto Trait Implementations

impl<K, V, S> Send for WeakValueHashMap<K, V, S> where
    K: Send,
    S: Send,
    V: Send

impl<K, V, S> Sync for WeakValueHashMap<K, V, S> where
    K: Sync,
    S: Sync,
    V: Sync