[−][src]Struct weak_table::PtrWeakHashSet
A hash set with weak elements, hashed on element pointer.
When a weak pointer expires, its mapping is lazily removed.
Implementations
impl<T: WeakElement> PtrWeakHashSet<T, RandomState> where
T::Strong: Deref,
[src]
T::Strong: Deref,
pub fn new() -> Self
[src]
Creates an empty PtrWeakHashSet
.
pub fn with_capacity(capacity: usize) -> Self
[src]
Creates an empty PtrWeakHashSet
with the given capacity.
impl<T: WeakElement, S: BuildHasher> PtrWeakHashSet<T, S> where
T::Strong: Deref,
[src]
T::Strong: Deref,
pub fn with_hasher(hash_builder: S) -> Self
[src]
Creates an empty PtrWeakHashSet
with the given capacity and hasher.
pub fn with_capacity_and_hasher(capacity: usize, hash_builder: S) -> Self
[src]
Creates an empty PtrWeakHashSet
with the given capacity and hasher.
pub fn hasher(&self) -> &S
[src]
Returns a reference to the map's BuildHasher
.
pub fn capacity(&self) -> usize
[src]
Returns the number of elements the map can hold without reallocating.
pub fn remove_expired(&mut self)
[src]
Removes all mappings whose keys have expired.
pub fn reserve(&mut self, additional_capacity: usize)
[src]
Reserves room for additional elements.
pub fn shrink_to_fit(&mut self)
[src]
Shrinks the capacity to the minimum allowed to hold the current number of elements.
pub fn len(&self) -> usize
[src]
Returns an over-approximation of the number of elements.
pub fn is_empty(&self) -> bool
[src]
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]
The proportion of buckets that are used.
This is an over-approximation because of expired elements.
pub fn clear(&mut self)
[src]
Removes all associations from the map.
pub fn contains(&self, key: &T::Strong) -> bool
[src]
Returns true if the map contains the specified key.
pub fn insert(&mut self, key: T::Strong) -> bool
[src]
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]
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]
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]
S1: BuildHasher,
Is self a subset of other?
impl<T: WeakElement, S> PtrWeakHashSet<T, S> where
T::Strong: Deref,
[src]
T::Strong: Deref,
pub fn iter(&self) -> Iter<T>
[src]
Gets an iterator over the keys and values.
pub fn drain(&mut self) -> Drain<T>
[src]
Gets a draining iterator, which removes all the values but retains the storage.
Trait Implementations
impl<T: Clone, S: Clone> Clone for PtrWeakHashSet<T, S>
[src]
fn clone(&self) -> PtrWeakHashSet<T, S>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<T, S> Debug for PtrWeakHashSet<T, S> where
T: WeakElement,
T::Strong: Debug,
[src]
T: WeakElement,
T::Strong: Debug,
impl<T: WeakElement, S: BuildHasher + Default> Default for PtrWeakHashSet<T, S> where
T::Strong: Deref,
[src]
T::Strong: Deref,
impl<T: WeakElement, S: BuildHasher> Eq for PtrWeakHashSet<T, S> where
T::Strong: Deref,
[src]
T::Strong: Deref,
impl<T, S> Extend<<T as WeakElement>::Strong> for PtrWeakHashSet<T, S> where
T: WeakElement,
T::Strong: Deref,
S: BuildHasher,
[src]
T: WeakElement,
T::Strong: Deref,
S: BuildHasher,
fn extend<I: IntoIterator<Item = T::Strong>>(&mut self, iter: I)
[src]
fn extend_one(&mut self, item: A)
[src]
fn extend_reserve(&mut self, additional: usize)
[src]
impl<T, S> FromIterator<<T as WeakElement>::Strong> for PtrWeakHashSet<T, S> where
T: WeakElement,
T::Strong: Deref,
S: BuildHasher + Default,
[src]
T: WeakElement,
T::Strong: Deref,
S: BuildHasher + Default,
fn from_iter<I: IntoIterator<Item = T::Strong>>(iter: I) -> Self
[src]
impl<T: WeakElement, S> IntoIterator for PtrWeakHashSet<T, S>
[src]
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]
impl<'a, T: WeakElement, S> IntoIterator for &'a PtrWeakHashSet<T, S> where
T::Strong: Deref,
[src]
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]
impl<T, S, S1> PartialEq<PtrWeakHashSet<T, S1>> for PtrWeakHashSet<T, S> where
T: WeakElement,
T::Strong: Deref,
S: BuildHasher,
S1: BuildHasher,
[src]
T: WeakElement,
T::Strong: Deref,
S: BuildHasher,
S1: BuildHasher,
Auto Trait Implementations
impl<T, S> RefUnwindSafe for PtrWeakHashSet<T, S> where
S: RefUnwindSafe,
T: RefUnwindSafe,
S: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, S> Send for PtrWeakHashSet<T, S> where
S: Send,
T: Send,
S: Send,
T: Send,
impl<T, S> Sync for PtrWeakHashSet<T, S> where
S: Sync,
T: Sync,
S: Sync,
T: Sync,
impl<T, S> Unpin for PtrWeakHashSet<T, S> where
S: Unpin,
S: Unpin,
impl<T, S> UnwindSafe for PtrWeakHashSet<T, S> where
S: UnwindSafe,
T: UnwindSafe,
S: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<I> IntoIterator for I where
I: Iterator,
[src]
I: Iterator,
type Item = <I as Iterator>::Item
The type of the elements being iterated over.
type IntoIter = I
Which kind of iterator are we turning this into?
fn into_iter(self) -> I
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,