pub struct HashSetRef<'set, T, S = DefaultHashBuilder> { /* private fields */ }
Expand description
A reference to a HashSet
, constructed with HashSet::pin
or HashSet::with_guard
.
The current thread will be pinned for the duration of this reference. Keep in mind that this prevents the collection of garbage generated by the set.
Implementations§
Source§impl<T, S> HashSetRef<'_, T, S>
impl<T, S> HashSetRef<'_, T, S>
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Returns the number of elements in the set.
See also HashSet::len
.
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns true
if the set is empty. Otherwise returns false
.
See also HashSet::is_empty
.
Source§impl<T, S> HashSetRef<'_, T, S>
impl<T, S> HashSetRef<'_, T, S>
Sourcepub fn contains<Q>(&self, value: &Q) -> bool
pub fn contains<Q>(&self, value: &Q) -> bool
Returns true
if the given value is an element of this set.
See also HashSet::contains
.
Sourcepub fn get<'g, Q>(&'g self, value: &Q) -> Option<&'g T>
pub fn get<'g, Q>(&'g self, value: &Q) -> Option<&'g T>
Returns a reference to the element in the set, if any, that is equal to the given value.
See also HashSet::get
.
Sourcepub fn is_disjoint(&self, other: &HashSetRef<'_, T, S>) -> bool
pub fn is_disjoint(&self, other: &HashSetRef<'_, T, S>) -> bool
Returns true
if self
has no elements in common with other
.
See also HashSet::is_disjoint
.
Sourcepub fn is_subset(&self, other: &HashSetRef<'_, T, S>) -> bool
pub fn is_subset(&self, other: &HashSetRef<'_, T, S>) -> bool
Returns true
if the set is a subset of another, i.e., other
contains at least all the values in self
.
See also HashSet::is_subset
.
Sourcepub fn is_superset(&self, other: &HashSetRef<'_, T, S>) -> bool
pub fn is_superset(&self, other: &HashSetRef<'_, T, S>) -> bool
Returns true
if the set is a superset of another, i.e., self
contains at least all the values in other
.
See also HashSet::is_superset
.
Source§impl<T, S> HashSetRef<'_, T, S>
impl<T, S> HashSetRef<'_, T, S>
Sourcepub fn insert(&self, value: T) -> bool
pub fn insert(&self, value: T) -> bool
Adds a value to the set.
See also HashSet::insert
.
Sourcepub fn remove<Q>(&self, value: &Q) -> bool
pub fn remove<Q>(&self, value: &Q) -> bool
Removes a value from the set.
See also HashSet::remove
.
Source§impl<T, S> HashSetRef<'_, T, S>
impl<T, S> HashSetRef<'_, T, S>
Sourcepub fn clear(&self)
pub fn clear(&self)
Clears the set, removing all elements.
See also HashSet::clear
.
Sourcepub fn reserve(&self, additional: usize)
pub fn reserve(&self, additional: usize)
Tries to reserve capacity for at least additional
more elements to
be inserted into the underlying HashSet
.
See also HashSet::reserve
.