Struct weak_table::PtrWeakHashSet
[−]
[src]
pub struct PtrWeakHashSet<T, S = RandomState>(_);
A hash set with weak elements, hashed on element pointer.
When a weak pointer expires, its mapping is lazily removed.
Methods
impl<T: WeakElement> PtrWeakHashSet<T, RandomState> where
T::Strong: Deref,
[src]
impl<T: WeakElement> PtrWeakHashSet<T, RandomState> where
T::Strong: Deref,
pub fn new() -> Self
[src]
pub fn new() -> Self
Creates an empty PtrWeakHashSet
.
pub fn with_capacity(capacity: usize) -> Self
[src]
pub fn with_capacity(capacity: usize) -> Self
Creates an empty PtrWeakHashSet
with the given capacity.
impl<T: WeakElement, S: BuildHasher> PtrWeakHashSet<T, S> where
T::Strong: Deref,
[src]
impl<T: WeakElement, S: BuildHasher> PtrWeakHashSet<T, S> where
T::Strong: Deref,
pub fn with_hasher(hash_builder: S) -> Self
[src]
pub fn with_hasher(hash_builder: S) -> Self
Creates an empty PtrWeakHashSet
with the given capacity and hasher.
pub fn with_capacity_and_hasher(capacity: usize, hash_builder: S) -> Self
[src]
pub fn with_capacity_and_hasher(capacity: usize, hash_builder: S) -> Self
Creates an empty PtrWeakHashSet
with the given capacity and hasher.
pub fn hasher(&self) -> &S
[src]
pub fn hasher(&self) -> &S
Returns a reference to the map's BuildHasher
.
pub fn capacity(&self) -> usize
[src]
pub fn capacity(&self) -> usize
Returns the number of elements the map can hold without reallocating.
pub fn remove_expired(&mut self)
[src]
pub fn remove_expired(&mut self)
Removes all mappings whose keys have expired.
pub fn reserve(&mut self, additional_capacity: usize)
[src]
pub fn reserve(&mut self, additional_capacity: usize)
Reserves room for additional elements.
pub fn shrink_to_fit(&mut self)
[src]
pub fn shrink_to_fit(&mut self)
Shrinks the capacity to the minimum allowed to hold the current number of elements.
pub fn len(&self) -> usize
[src]
pub fn len(&self) -> usize
Returns an over-approximation of the number of elements.
pub fn is_empty(&self) -> bool
[src]
pub fn is_empty(&self) -> bool
Is the set known to be empty?
This could answer false
for an empty set whose elements have
expired but have yet to be collected.
pub fn load_factor(&self) -> f32
[src]
pub fn load_factor(&self) -> f32
The proportion of buckets that are used.
This is an over-approximation because of expired elements.
pub fn clear(&mut self)
[src]
pub fn clear(&mut self)
Removes all associations from the map.
pub fn contains(&self, key: &T::Strong) -> bool
[src]
pub fn contains(&self, key: &T::Strong) -> bool
Returns true if the map contains the specified key.
pub fn insert(&mut self, key: T::Strong) -> bool
[src]
pub fn insert(&mut self, key: T::Strong) -> bool
Unconditionally inserts the value, returning the old value if already present. Does not replace the key.
pub fn remove(&mut self, key: &T::Strong) -> bool
[src]
pub fn remove(&mut self, key: &T::Strong) -> bool
Removes the entry with the given key, if it exists, and returns the value.
pub fn retain<F>(&mut self, f: F) where
F: FnMut(T::Strong) -> bool,
[src]
pub fn retain<F>(&mut self, f: F) where
F: FnMut(T::Strong) -> bool,
Removes all mappings not satisfying the given predicate.
Also removes any expired mappings.
pub fn is_subset<S1>(&self, other: &PtrWeakHashSet<T, S1>) -> bool where
S1: BuildHasher,
[src]
pub fn is_subset<S1>(&self, other: &PtrWeakHashSet<T, S1>) -> bool where
S1: BuildHasher,
Is self a subset of other?
impl<T: WeakElement, S> PtrWeakHashSet<T, S> where
T::Strong: Deref,
[src]
impl<T: WeakElement, S> PtrWeakHashSet<T, S> where
T::Strong: Deref,
ⓘImportant traits for Iter<'a, T>pub fn iter(&self) -> Iter<T>
[src]
pub fn iter(&self) -> Iter<T>
Gets an iterator over the keys and values.
ⓘImportant traits for Drain<'a, T>pub fn drain(&mut self) -> Drain<T>
[src]
pub fn drain(&mut self) -> Drain<T>
Gets a draining iterator, which removes all the values but retains the storage.
Trait Implementations
impl<T, S, S1> PartialEq<PtrWeakHashSet<T, S1>> for PtrWeakHashSet<T, S> where
T: WeakElement,
T::Strong: Deref,
S: BuildHasher,
S1: BuildHasher,
[src]
impl<T, S, S1> PartialEq<PtrWeakHashSet<T, S1>> for PtrWeakHashSet<T, S> where
T: WeakElement,
T::Strong: Deref,
S: BuildHasher,
S1: BuildHasher,
fn eq(&self, other: &PtrWeakHashSet<T, S1>) -> bool
[src]
fn eq(&self, other: &PtrWeakHashSet<T, S1>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl<T: WeakElement, S: BuildHasher> Eq for PtrWeakHashSet<T, S> where
T::Strong: Deref,
[src]
impl<T: WeakElement, S: BuildHasher> Eq for PtrWeakHashSet<T, S> where
T::Strong: Deref,
impl<T: WeakElement, S: BuildHasher + Default> Default for PtrWeakHashSet<T, S> where
T::Strong: Deref,
[src]
impl<T: WeakElement, S: BuildHasher + Default> Default for PtrWeakHashSet<T, S> where
T::Strong: Deref,
impl<T, S> FromIterator<T::Strong> for PtrWeakHashSet<T, S> where
T: WeakElement,
T::Strong: Deref,
S: BuildHasher + Default,
[src]
impl<T, S> FromIterator<T::Strong> for PtrWeakHashSet<T, S> where
T: WeakElement,
T::Strong: Deref,
S: BuildHasher + Default,
fn from_iter<I: IntoIterator<Item = T::Strong>>(iter: I) -> Self
[src]
fn from_iter<I: IntoIterator<Item = T::Strong>>(iter: I) -> Self
Creates a value from an iterator. Read more
impl<T, S> Extend<T::Strong> for PtrWeakHashSet<T, S> where
T: WeakElement,
T::Strong: Deref,
S: BuildHasher,
[src]
impl<T, S> Extend<T::Strong> for PtrWeakHashSet<T, S> where
T: WeakElement,
T::Strong: Deref,
S: BuildHasher,
fn extend<I: IntoIterator<Item = T::Strong>>(&mut self, iter: I)
[src]
fn extend<I: IntoIterator<Item = T::Strong>>(&mut self, iter: I)
Extends a collection with the contents of an iterator. Read more
impl<T, S> Debug for PtrWeakHashSet<T, S> where
T: WeakElement,
T::Strong: Debug,
[src]
impl<T, S> Debug for PtrWeakHashSet<T, S> where
T: WeakElement,
T::Strong: Debug,
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl<T: WeakElement, S> IntoIterator for PtrWeakHashSet<T, S>
[src]
impl<T: WeakElement, S> IntoIterator for PtrWeakHashSet<T, S>
type Item = T::Strong
The type of the elements being iterated over.
type IntoIter = IntoIter<T>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
fn into_iter(self) -> Self::IntoIter
Creates an iterator from a value. Read more
impl<'a, T: WeakElement, S> IntoIterator for &'a PtrWeakHashSet<T, S> where
T::Strong: Deref,
[src]
impl<'a, T: WeakElement, S> IntoIterator for &'a PtrWeakHashSet<T, S> where
T::Strong: Deref,
type Item = T::Strong
The type of the elements being iterated over.
type IntoIter = Iter<'a, T>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
fn into_iter(self) -> Self::IntoIter
Creates an iterator from a value. Read more
impl<T: Clone, S: Clone> Clone for PtrWeakHashSet<T, S>
[src]
impl<T: Clone, S: Clone> Clone for PtrWeakHashSet<T, S>
fn clone(&self) -> PtrWeakHashSet<T, S>
[src]
fn clone(&self) -> PtrWeakHashSet<T, S>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
Auto Trait Implementations
impl<T, S> Send for PtrWeakHashSet<T, S> where
S: Send,
T: Send,
impl<T, S> Send for PtrWeakHashSet<T, S> where
S: Send,
T: Send,
impl<T, S> Sync for PtrWeakHashSet<T, S> where
S: Sync,
T: Sync,
impl<T, S> Sync for PtrWeakHashSet<T, S> where
S: Sync,
T: Sync,