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
with the given capacity.
Creates an empty WeakWeakHashMap
with the given capacity and hasher.
Creates an empty WeakWeakHashMap
with the given capacity and hasher.
Returns the number of elements the map can hold without reallocating.
Removes all mappings whose keys have expired.
Shrinks the capacity to the minimum allowed to hold the current 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.
Returns a reference to the value corresponding to the key.
Returns the strong reference to the key, if present.
Returns strong references to both the key and the value, if present.
Returns true if the map contains the specified key.
Unconditionally inserts the value, returning the old value if already present.
Unlike std::collections::HashMap
, this replaces 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.
pub fn is_submap_with<F, S1, V1>(
&self,
other: &WeakWeakHashMap<K, V1, S1>,
value_equal: F
) -> bool where
V1: WeakElement,
F: FnMut(V::Strong, V1::Strong) -> bool,
S1: BuildHasher,
pub fn is_submap_with<F, S1, V1>(
&self,
other: &WeakWeakHashMap<K, V1, S1>,
value_equal: F
) -> bool where
V1: WeakElement,
F: FnMut(V::Strong, V1::Strong) -> bool,
S1: BuildHasher,
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
.
pub fn is_submap<V1, S1>(&self, other: &WeakWeakHashMap<K, V1, S1>) -> bool where
V1: WeakElement,
V::Strong: PartialEq<V1::Strong>,
S1: BuildHasher,
pub fn is_submap<V1, S1>(&self, other: &WeakWeakHashMap<K, V1, S1>) -> bool where
V1: WeakElement,
V::Strong: PartialEq<V1::Strong>,
S1: BuildHasher,
Is self
a submap of other
?
pub fn domain_is_subset<V1, S1>(
&self,
other: &WeakWeakHashMap<K, V1, S1>
) -> bool where
V1: WeakElement,
S1: BuildHasher,
pub fn domain_is_subset<V1, S1>(
&self,
other: &WeakWeakHashMap<K, V1, S1>
) -> bool where
V1: WeakElement,
S1: BuildHasher,
Are the keys of self
a subset of the keys of other
?
Gets an iterator over the keys and values.
pub fn keys(&self) -> Keys<'_, K, V>ⓘNotable traits for Keys<'a, K, V>impl<'a, K: WeakElement, V: WeakElement> Iterator for Keys<'a, K, V> type Item = K::Strong;
pub fn keys(&self) -> Keys<'_, K, V>ⓘNotable traits for Keys<'a, K, V>impl<'a, K: WeakElement, V: WeakElement> Iterator for Keys<'a, K, V> type Item = K::Strong;
impl<'a, K: WeakElement, V: WeakElement> Iterator for Keys<'a, K, V> type Item = K::Strong;
Gets an iterator over the keys.
pub fn values(&self) -> Values<'_, K, V>ⓘNotable traits for Values<'a, K, V>impl<'a, K: WeakElement, V: WeakElement> Iterator for Values<'a, K, V> type Item = V::Strong;
pub fn values(&self) -> Values<'_, K, V>ⓘNotable traits for Values<'a, K, V>impl<'a, K: WeakElement, V: WeakElement> Iterator for Values<'a, K, V> type Item = V::Strong;
impl<'a, K: WeakElement, V: WeakElement> Iterator for Values<'a, K, V> type Item = V::Strong;
Gets an iterator over the values.
Trait Implementations
impl<K: WeakElement, V: WeakElement, S> Debug for WeakWeakHashMap<K, V, S> where
K::Strong: Debug,
V::Strong: Debug,
impl<K: WeakElement, V: WeakElement, S> Debug for WeakWeakHashMap<K, V, S> where
K::Strong: Debug,
V::Strong: Debug,
impl<K: WeakKey, V: WeakElement, S: BuildHasher + Default> Default for WeakWeakHashMap<K, V, S>
impl<K: WeakKey, V: WeakElement, S: BuildHasher + Default> Default for WeakWeakHashMap<K, V, S>
impl<K, V, S> Extend<(<K as WeakElement>::Strong, <V as WeakElement>::Strong)> for WeakWeakHashMap<K, V, S> where
K: WeakKey,
V: WeakElement,
S: BuildHasher,
impl<K, V, S> Extend<(<K as WeakElement>::Strong, <V as WeakElement>::Strong)> for WeakWeakHashMap<K, V, S> where
K: WeakKey,
V: WeakElement,
S: BuildHasher,
Extends a collection with the contents of an iterator. Read more
extend_one
)Extends a collection with exactly one element.
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
impl<K, V, S> FromIterator<(<K as WeakElement>::Strong, <V as WeakElement>::Strong)> for WeakWeakHashMap<K, V, S> where
K: WeakKey,
V: WeakElement,
S: BuildHasher + Default,
impl<K, V, S> FromIterator<(<K as WeakElement>::Strong, <V as WeakElement>::Strong)> for WeakWeakHashMap<K, V, S> where
K: WeakKey,
V: WeakElement,
S: BuildHasher + Default,
impl<K, V, V1, S, S1> PartialEq<WeakWeakHashMap<K, V1, S1>> for WeakWeakHashMap<K, V, S> where
K: WeakKey,
V: WeakElement,
V1: WeakElement,
V::Strong: PartialEq<V1::Strong>,
S: BuildHasher,
S1: BuildHasher,
impl<K, V, V1, S, S1> PartialEq<WeakWeakHashMap<K, V1, S1>> for WeakWeakHashMap<K, V, S> where
K: WeakKey,
V: WeakElement,
V1: WeakElement,
V::Strong: PartialEq<V1::Strong>,
S: BuildHasher,
S1: BuildHasher,
impl<K: WeakKey, V: WeakElement, S: BuildHasher> Eq for WeakWeakHashMap<K, V, S> where
V::Strong: Eq,
Auto Trait Implementations
impl<K, V, S> RefUnwindSafe for WeakWeakHashMap<K, V, S> where
K: RefUnwindSafe,
S: RefUnwindSafe,
V: RefUnwindSafe,
impl<K, V, S> Send for WeakWeakHashMap<K, V, S> where
K: Send,
S: Send,
V: Send,
impl<K, V, S> Sync for WeakWeakHashMap<K, V, S> where
K: Sync,
S: Sync,
V: Sync,
impl<K, V, S> Unpin for WeakWeakHashMap<K, V, S> where
S: Unpin,
impl<K, V, S> UnwindSafe for WeakWeakHashMap<K, V, S> where
K: UnwindSafe,
S: UnwindSafe,
V: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more