Struct weak_table::WeakWeakHashMap[][src]

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

A hash map with weak keys and weak values, hashed on key value.

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

Implementations

Creates an empty WeakWeakHashMap.

O(1) time

Creates an empty WeakWeakHashMap with the given capacity.

O(n) time

Creates an empty WeakWeakHashMap with the given capacity and hasher.

O(n) time

Creates an empty WeakWeakHashMap with the given capacity and hasher.

O(n) time

Returns a reference to the map’s BuildHasher.

O(1) time

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

O(1) time

Removes all mappings whose keys have expired.

O(n) time

Reserves room for additional elements.

O(n) time

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

O(n) time

Returns an over-approximation of the number of elements.

O(1) time

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.

O(1) time

The proportion of buckets that are used.

This is an over-approximation because of expired keys.

O(1) time

Gets the requested entry.

expected O(n) time; worst-case O(nq) time (where n is self.capacity() and q is the length of the probe sequences in other)

Removes all associations from the map.

O(n) time

Returns a reference to the value corresponding to the key.

expected O(1) time; worst-case O(p) time

Returns the strong reference to the key, if present.

expected O(1) time; worst-case O(p) time

Returns strong references to both the key and the value, if present.

expected O(1) time; worst-case O(p) time

Returns true if the map contains the specified key.

expected O(1) time; worst-case O(p) time

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

Unlike std::collections::HashMap, this replaces the key even if occupied.

expected O(1) time; worst-case O(p) time

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

expected O(1) time; worst-case O(p) time

Removes all mappings not satisfying the given predicate.

Also removes any expired mappings.

O(n) time

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.

expected O(n) time; worst-case O(nq) time (where n is self.capacity() and q is the length of the probe sequences in other)

Is self a submap of other?

expected O(n) time; worst-case O(nq) time (where n is self.capacity() and q is the length of the probe sequences in other)

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

expected O(n) time; worst-case O(nq) time (where n is self.capacity() and q is the length of the probe sequences in other)

Gets an iterator over the keys and values.

O(1) time

Gets an iterator over the keys.

O(1) time

Gets an iterator over the values.

O(1) time

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

O(1) time (and O(n) time to dispose of the result)

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

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

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

Extends a collection with exactly one element.

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

Reserves capacity in a collection for the given number of additional elements. Read more

Creates a value from an iterator. Read more

Creates an owning iterator from self.

O(1) time (and O(n) time to dispose of the result)

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates a borrowing iterator from self.

O(1) time

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

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

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

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

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.