Struct enso_flexer::prelude::weak_table::weak_hash_set::WeakHashSet [−][src]
pub struct WeakHashSet<T, S = RandomState>(_);
Expand description
A hash set with weak elements, hashed on element value.
When a weak pointer expires, its mapping is lazily removed.
Implementations
impl<T> WeakHashSet<T, RandomState> where
T: WeakKey,
[src]
impl<T> WeakHashSet<T, RandomState> where
T: WeakKey,
[src]pub fn new() -> WeakHashSet<T, RandomState>
[src]
pub fn new() -> WeakHashSet<T, RandomState>
[src]Creates an empty WeakHashSet
.
pub fn with_capacity(capacity: usize) -> WeakHashSet<T, RandomState>
[src]
pub fn with_capacity(capacity: usize) -> WeakHashSet<T, RandomState>
[src]Creates an empty WeakHashSet
with the given capacity.
impl<T, S> WeakHashSet<T, S> where
T: WeakKey,
S: BuildHasher,
[src]
impl<T, S> WeakHashSet<T, S> where
T: WeakKey,
S: BuildHasher,
[src]pub fn with_hasher(hash_builder: S) -> WeakHashSet<T, S>
[src]
pub fn with_hasher(hash_builder: S) -> WeakHashSet<T, S>
[src]Creates an empty WeakHashSet
with the given capacity and hasher.
pub fn with_capacity_and_hasher(
capacity: usize,
hash_builder: S
) -> WeakHashSet<T, S>
[src]
pub fn with_capacity_and_hasher(
capacity: usize,
hash_builder: S
) -> WeakHashSet<T, S>
[src]Creates an empty WeakHashSet
with the given capacity and hasher.
pub fn capacity(&self) -> usize
[src]
pub fn capacity(&self) -> usize
[src]Returns the number of elements the map can hold without reallocating.
pub fn remove_expired(&mut self)
[src]
pub fn remove_expired(&mut self)
[src]Removes all mappings whose keys have expired.
pub fn shrink_to_fit(&mut self)
[src]
pub fn shrink_to_fit(&mut self)
[src]Shrinks the capacity to the minimum allowed to hold the current number of elements.
pub fn is_empty(&self) -> bool
[src]
pub fn is_empty(&self) -> bool
[src]Is the set empty?
Note that this may return false even if all keys in the set have expired, if they haven’t been collected yet.
pub fn load_factor(&self) -> f32
[src]
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 contains<Q>(&self, key: &Q) -> bool where
Q: Eq + Hash + ?Sized,
<T as WeakKey>::Key: Borrow<Q>,
[src]
pub fn contains<Q>(&self, key: &Q) -> bool where
Q: Eq + Hash + ?Sized,
<T as WeakKey>::Key: Borrow<Q>,
[src]Returns true if the map contains the specified key.
pub fn get<Q>(&self, key: &Q) -> Option<<T as WeakElement>::Strong> where
Q: Eq + Hash + ?Sized,
<T as WeakKey>::Key: Borrow<Q>,
[src]
pub fn get<Q>(&self, key: &Q) -> Option<<T as WeakElement>::Strong> where
Q: Eq + Hash + ?Sized,
<T as WeakKey>::Key: Borrow<Q>,
[src]Gets a strong reference to the given key, if found.
Examples
use weak_table::WeakHashSet; use std::rc::{Rc, Weak}; use std::ops::Deref; let mut set: WeakHashSet<Weak<String>> = WeakHashSet::new(); let a = Rc::new("a".to_owned()); set.insert(a.clone()); let also_a = set.get("a").unwrap(); assert!(Rc::ptr_eq( &a, &also_a ));
pub fn insert(&mut self, key: <T as WeakElement>::Strong) -> bool
[src]
pub fn insert(&mut self, key: <T as WeakElement>::Strong) -> bool
[src]Unconditionally inserts the value, returning the old value if already present. Does not replace the key.
pub fn remove<Q>(&mut self, key: &Q) -> bool where
Q: Eq + Hash + ?Sized,
<T as WeakKey>::Key: Borrow<Q>,
[src]
pub fn remove<Q>(&mut self, key: &Q) -> bool where
Q: Eq + Hash + ?Sized,
<T as WeakKey>::Key: Borrow<Q>,
[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 as WeakElement>::Strong) -> bool,
[src]
pub fn retain<F>(&mut self, f: F) where
F: FnMut(<T as WeakElement>::Strong) -> bool,
[src]Removes all mappings not satisfying the given predicate.
Also removes any expired mappings.
pub fn is_subset<S1>(&self, other: &WeakHashSet<T, S1>) -> bool where
S1: BuildHasher,
[src]
pub fn is_subset<S1>(&self, other: &WeakHashSet<T, S1>) -> bool where
S1: BuildHasher,
[src]Is self a subset of other?
impl<T, S> WeakHashSet<T, S> where
T: WeakKey,
[src]
impl<T, S> WeakHashSet<T, S> where
T: WeakKey,
[src]pub fn iter(&self) -> Iter<'_, T>ⓘNotable traits for Iter<'a, T>
impl<'a, T> Iterator for Iter<'a, T> where
T: WeakElement, type Item = <T as WeakElement>::Strong;
[src]
pub fn iter(&self) -> Iter<'_, T>ⓘNotable traits for Iter<'a, T>
impl<'a, T> Iterator for Iter<'a, T> where
T: WeakElement, type Item = <T as WeakElement>::Strong;
[src]Gets an iterator over the keys and values.
pub fn drain(&mut self) -> Drain<'_, T>ⓘNotable traits for Drain<'a, T>
impl<'a, T> Iterator for Drain<'a, T> where
T: WeakElement, type Item = <T as WeakElement>::Strong;
[src]
pub fn drain(&mut self) -> Drain<'_, T>ⓘNotable traits for Drain<'a, T>
impl<'a, T> Iterator for Drain<'a, T> where
T: WeakElement, type Item = <T as WeakElement>::Strong;
[src]Gets a draining iterator, which removes all the values but retains the storage.
Trait Implementations
impl<T, S> Clone for WeakHashSet<T, S> where
T: Clone,
S: Clone,
[src]
impl<T, S> Clone for WeakHashSet<T, S> where
T: Clone,
S: Clone,
[src]pub fn clone(&self) -> WeakHashSet<T, S>
[src]
pub fn clone(&self) -> WeakHashSet<T, S>
[src]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)
1.0.0[src]Performs copy-assignment from source
. Read more
impl<T, S> Debug for WeakHashSet<T, S> where
T: WeakKey,
<T as WeakElement>::Strong: Debug,
[src]
impl<T, S> Debug for WeakHashSet<T, S> where
T: WeakKey,
<T as WeakElement>::Strong: Debug,
[src]impl<T, S> Default for WeakHashSet<T, S> where
T: WeakKey,
S: BuildHasher + Default,
[src]
impl<T, S> Default for WeakHashSet<T, S> where
T: WeakKey,
S: BuildHasher + Default,
[src]pub fn default() -> WeakHashSet<T, S>
[src]
pub fn default() -> WeakHashSet<T, S>
[src]Returns the “default value” for a type. Read more
impl<T, S> Extend<<T as WeakElement>::Strong> for WeakHashSet<T, S> where
T: WeakKey,
S: BuildHasher,
[src]
impl<T, S> Extend<<T as WeakElement>::Strong> for WeakHashSet<T, S> where
T: WeakKey,
S: BuildHasher,
[src]pub fn extend<I>(&mut self, iter: I) where
I: IntoIterator<Item = <T as WeakElement>::Strong>,
[src]
pub fn extend<I>(&mut self, iter: I) where
I: IntoIterator<Item = <T as WeakElement>::Strong>,
[src]Extends a collection with the contents of an iterator. Read more
fn extend_one(&mut self, item: A)
[src]
fn extend_one(&mut self, item: A)
[src]extend_one
)Extends a collection with exactly one element.
fn extend_reserve(&mut self, additional: usize)
[src]
fn extend_reserve(&mut self, additional: usize)
[src]extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
impl<T, S> FromIterator<<T as WeakElement>::Strong> for WeakHashSet<T, S> where
T: WeakKey,
S: BuildHasher + Default,
[src]
impl<T, S> FromIterator<<T as WeakElement>::Strong> for WeakHashSet<T, S> where
T: WeakKey,
S: BuildHasher + Default,
[src]pub fn from_iter<I>(iter: I) -> WeakHashSet<T, S> where
I: IntoIterator<Item = <T as WeakElement>::Strong>,
[src]
pub fn from_iter<I>(iter: I) -> WeakHashSet<T, S> where
I: IntoIterator<Item = <T as WeakElement>::Strong>,
[src]Creates a value from an iterator. Read more
impl<T, S> IntoIterator for WeakHashSet<T, S> where
T: WeakKey,
[src]
impl<T, S> IntoIterator for WeakHashSet<T, S> where
T: WeakKey,
[src]type Item = <T as WeakElement>::Strong
type Item = <T as WeakElement>::Strong
The type of the elements being iterated over.
pub fn into_iter(self) -> <WeakHashSet<T, S> as IntoIterator>::IntoIter
[src]
pub fn into_iter(self) -> <WeakHashSet<T, S> as IntoIterator>::IntoIter
[src]Creates an iterator from a value. Read more
impl<'a, T, S> IntoIterator for &'a WeakHashSet<T, S> where
T: WeakKey,
[src]
impl<'a, T, S> IntoIterator for &'a WeakHashSet<T, S> where
T: WeakKey,
[src]type Item = <T as WeakElement>::Strong
type Item = <T as WeakElement>::Strong
The type of the elements being iterated over.
pub fn into_iter(self) -> <&'a WeakHashSet<T, S> as IntoIterator>::IntoIter
[src]
pub fn into_iter(self) -> <&'a WeakHashSet<T, S> as IntoIterator>::IntoIter
[src]Creates an iterator from a value. Read more
impl<T, S, S1> PartialEq<WeakHashSet<T, S1>> for WeakHashSet<T, S> where
T: WeakKey,
S: BuildHasher,
S1: BuildHasher,
[src]
impl<T, S, S1> PartialEq<WeakHashSet<T, S1>> for WeakHashSet<T, S> where
T: WeakKey,
S: BuildHasher,
S1: BuildHasher,
[src]impl<T, S> Eq for WeakHashSet<T, S> where
T: WeakKey,
S: BuildHasher,
<T as WeakKey>::Key: Eq,
[src]
T: WeakKey,
S: BuildHasher,
<T as WeakKey>::Key: Eq,
Auto Trait Implementations
impl<T, S> RefUnwindSafe for WeakHashSet<T, S> where
S: RefUnwindSafe,
T: RefUnwindSafe,
S: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, S> Send for WeakHashSet<T, S> where
S: Send,
T: Send,
S: Send,
T: Send,
impl<T, S> Sync for WeakHashSet<T, S> where
S: Sync,
T: Sync,
S: Sync,
T: Sync,
impl<T, S> Unpin for WeakHashSet<T, S> where
S: Unpin,
S: Unpin,
impl<T, S> UnwindSafe for WeakHashSet<T, S> where
S: UnwindSafe,
T: UnwindSafe,
S: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> HasRefValue for T where
T: ?Sized,
[src]
impl<T> HasRefValue for T where
T: ?Sized,
[src]type RefValue = T
impl<T> PhantomConversions for T
[src]
impl<T> PhantomConversions for T
[src]fn phantom_into<P>() -> P where
Self: PhantomInto<P>,
[src]
Self: PhantomInto<P>,
fn phantom_from<P>() -> Self where
P: PhantomInto<Self>,
[src]
P: PhantomInto<Self>,
impl<T> Same<T> for T
impl<T> Same<T> for T
type Output = T
type Output = T
Should always be Self
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
pub fn to_subset(&self) -> Option<SS>
pub fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct self
from the equivalent element of its
superset. Read more
pub fn is_in_subset(&self) -> bool
pub fn is_in_subset(&self) -> bool
Checks if self
is actually part of its subset T
(and can be converted to it).
pub fn to_subset_unchecked(&self) -> SS
pub fn to_subset_unchecked(&self) -> SS
Use with care! Same as self.to_subset
but without any property checks. Always succeeds.
pub fn from_subset(element: &SS) -> SP
pub fn from_subset(element: &SS) -> SP
The inclusion map: converts self
to the equivalent element of its superset.
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
impl<T> TypeDisplay for T
[src]
impl<T> TypeDisplay for T
[src]pub default fn type_display() -> String
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
pub fn vzip(self) -> V
impl<T> Writer for T
[src]
impl<T> Writer for T
[src]pub default fn write_by_level(&self, message: &Array)
[src]
pub default fn write_by_level(&self, message: &Array)
[src]Write message using the appropriate console method.