Struct HashSetRef

Source
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>

Source

pub fn len(&self) -> usize

Returns the number of elements in the set.

See also HashSet::len.

Source

pub fn is_empty(&self) -> bool

Returns true if the set is empty. Otherwise returns false.

See also HashSet::is_empty.

Source

pub fn iter(&self) -> Keys<'_, T, ()>

An iterator visiting all elements in arbitrary order.

The iterator element type is &'g T.

See also HashSet::iter.

Source§

impl<T, S> HashSetRef<'_, T, S>
where T: Hash + Ord, S: BuildHasher,

Source

pub fn contains<Q>(&self, value: &Q) -> bool
where T: Borrow<Q>, Q: ?Sized + Hash + Ord,

Returns true if the given value is an element of this set.

See also HashSet::contains.

Source

pub fn get<'g, Q>(&'g self, value: &Q) -> Option<&'g T>
where T: Borrow<Q>, Q: ?Sized + Hash + Ord,

Returns a reference to the element in the set, if any, that is equal to the given value.

See also HashSet::get.

Source

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.

Source

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.

Source

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>
where T: Sync + Send + Clone + Hash + Ord, S: BuildHasher,

Source

pub fn insert(&self, value: T) -> bool

Adds a value to the set.

See also HashSet::insert.

Source

pub fn remove<Q>(&self, value: &Q) -> bool
where T: Borrow<Q>, Q: ?Sized + Hash + Ord,

Removes a value from the set.

See also HashSet::remove.

Source

pub fn take<'g, Q>(&'g self, value: &Q) -> Option<&'g T>
where T: Borrow<Q>, Q: ?Sized + Hash + Ord,

Removes and returns the value in the set, if any, that is equal to the given one.

See also HashSet::take.

Source

pub fn retain<F>(&self, f: F)
where F: FnMut(&T) -> bool,

Retains only the elements specified by the predicate.

See also HashSet::retain.

Source§

impl<T, S> HashSetRef<'_, T, S>
where T: Clone + Ord,

Source

pub fn clear(&self)

Clears the set, removing all elements.

See also HashSet::clear.

Source

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.

Trait Implementations§

Source§

impl<T, S> Clone for HashSetRef<'_, T, S>

Source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T, S> Debug for HashSetRef<'_, T, S>
where T: Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'g, T, S> IntoIterator for &'g HashSetRef<'_, T, S>

Source§

type IntoIter = Keys<'g, T, ()>

Which kind of iterator are we turning this into?
Source§

type Item = &'g T

The type of the elements being iterated over.
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<T, S> PartialEq<HashSet<T, S>> for HashSetRef<'_, T, S>
where T: Hash + Ord, S: BuildHasher,

Source§

fn eq(&self, other: &HashSet<T, S>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T, S> PartialEq<HashSetRef<'_, T, S>> for HashSet<T, S>
where T: Hash + Ord, S: BuildHasher,

Source§

fn eq(&self, other: &HashSetRef<'_, T, S>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T, S> PartialEq for HashSetRef<'_, T, S>
where T: Hash + Ord, S: BuildHasher,

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T, S> Eq for HashSetRef<'_, T, S>
where T: Hash + Ord, S: BuildHasher,

Auto Trait Implementations§

§

impl<'set, T, S> Freeze for HashSetRef<'set, T, S>

§

impl<'set, T, S> RefUnwindSafe for HashSetRef<'set, T, S>
where S: RefUnwindSafe,

§

impl<'set, T, S = DefaultHashBuilder> !Send for HashSetRef<'set, T, S>

§

impl<'set, T, S = DefaultHashBuilder> !Sync for HashSetRef<'set, T, S>

§

impl<'set, T, S> Unpin for HashSetRef<'set, T, S>

§

impl<'set, T, S> UnwindSafe for HashSetRef<'set, T, S>
where S: RefUnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.