Struct weak_table::WeakKeyHashMap[][src]

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

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

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

Implementations

Creates an empty WeakKeyHashMap.

Creates an empty WeakKeyHashMap with the given capacity.

Creates an empty WeakKeyHashMap with the given capacity and hasher.

Creates an empty WeakKeyHashMap with the given capacity and hasher.

Returns a reference to the map’s BuildHasher.

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

Removes all mappings whose keys have expired.

Reserves room for additional elements.

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

Returns an over-approximation of the number of elements.

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.

The proportion of buckets that are used.

This is an over-approximation because of expired keys.

Gets the requested entry.

Removes all associations from the map.

Returns a reference to the value corresponding to the key.

Returns true if the map contains the specified key.

Returns a strong reference to the key, if found.

Returns a pair of a strong reference to the key, and a reference to the value, if present.

Returns a mutable reference to the value corresponding to the key.

Returns a pair of a strong reference to the key, and a mutable reference to the value, if present.

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

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

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

Removes all mappings not satisfying the given predicate.

Also removes any expired mappings.

Is this map a submap of the other under the given value comparison cmp?

In particular, for every key k of self,

  • k must also be a key of other and
  • cmp(self[k], other[k]) must hold.

Is self a submap of other?

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

Gets an iterator over the keys and values.

Gets an iterator over the keys.

Gets an iterator over the values.

Gets an iterator over the keys and mutable values.

Gets an iterator over the mutable values.

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

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

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

The returned type after indexing.

Performs the indexing (container[index]) operation. Read more

Performs the mutable indexing (container[index]) operation. Read more

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more

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.