pub struct HashSetRef<'set, K, S, G> { /* private fields */ }
Expand description
A pinned reference to a HashSet
.
This type is created with HashSet::pin
and can be used to easily access a HashSet
without explicitly managing a guard. See the crate-level documentation for details.
Implementations§
Source§impl<'set, K, S, G> HashSetRef<'set, K, S, G>
impl<'set, K, S, G> HashSetRef<'set, K, S, G>
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Returns the number of entries in the set.
See HashSet::len
for details.
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns true
if the set is empty. Otherwise returns false
.
See HashSet::is_empty
for details.
Sourcepub fn contains<Q>(&self, key: &Q) -> bool
pub fn contains<Q>(&self, key: &Q) -> bool
Returns true
if the set contains a value for the specified key.
See HashSet::contains
for details.
Sourcepub fn get<Q>(&self, key: &Q) -> Option<&K>
pub fn get<Q>(&self, key: &Q) -> Option<&K>
Returns a reference to the value corresponding to the key.
See HashSet::get
for details.
Sourcepub fn insert(&self, key: K) -> bool
pub fn insert(&self, key: K) -> bool
Inserts a key-value pair into the set.
See HashSet::insert
for details.
Sourcepub fn remove<Q>(&self, key: &Q) -> bool
pub fn remove<Q>(&self, key: &Q) -> bool
Removes a key from the set, returning the value at the key if the key was previously in the set.
See HashSet::remove
for details.
Sourcepub fn clear(&self)
pub fn clear(&self)
Clears the set, removing all values.
See HashSet::clear
for details.
Sourcepub fn retain<F>(&mut self, f: F)
pub fn retain<F>(&mut self, f: F)
Retains only the elements specified by the predicate.
See HashSet::retain
for details.
Sourcepub fn reserve(&self, additional: usize)
pub fn reserve(&self, additional: usize)
Tries to reserve capacity for additional
more elements to be inserted
in the set.
See HashSet::reserve
for details.
Sourcepub fn iter(&self) -> Iter<'_, K, G>
pub fn iter(&self) -> Iter<'_, K, G>
An iterator visiting all values in arbitrary order.
The iterator element type is (&K, &V)
.
See HashSet::iter
for details.