[][src]Struct weak_table::PtrWeakHashSet

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.

Implementations

impl<T: WeakElement> PtrWeakHashSet<T, RandomState> where
    T::Strong: Deref
[src]

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]

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]

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]

Is self a subset of other?

impl<T: WeakElement, S> PtrWeakHashSet<T, S> where
    T::Strong: Deref
[src]

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]

impl<T, S> Debug for PtrWeakHashSet<T, S> where
    T: WeakElement,
    T::Strong: Debug
[src]

impl<T: WeakElement, S: BuildHasher + Default> Default for PtrWeakHashSet<T, S> where
    T::Strong: Deref
[src]

impl<T: WeakElement, S: BuildHasher> Eq for PtrWeakHashSet<T, S> where
    T::Strong: Deref
[src]

impl<T, S> Extend<<T as WeakElement>::Strong> for PtrWeakHashSet<T, S> where
    T: WeakElement,
    T::Strong: Deref,
    S: BuildHasher
[src]

impl<T, S> FromIterator<<T as WeakElement>::Strong> for PtrWeakHashSet<T, S> where
    T: WeakElement,
    T::Strong: Deref,
    S: BuildHasher + Default
[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?

impl<'a, T: WeakElement, S> IntoIterator for &'a PtrWeakHashSet<T, S> where
    T::Strong: Deref
[src]

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?

impl<T, S, S1> PartialEq<PtrWeakHashSet<T, S1>> for PtrWeakHashSet<T, S> where
    T: WeakElement,
    T::Strong: Deref,
    S: BuildHasher,
    S1: BuildHasher
[src]

Auto Trait Implementations

impl<T, S> RefUnwindSafe for PtrWeakHashSet<T, S> where
    S: RefUnwindSafe,
    T: RefUnwindSafe

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> Unpin for PtrWeakHashSet<T, S> where
    S: Unpin

impl<T, S> UnwindSafe for PtrWeakHashSet<T, S> where
    S: UnwindSafe,
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<I> IntoIterator for I where
    I: Iterator
[src]

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?

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.