Struct HashSetRef

Source
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>
where K: Hash + Eq, S: BuildHasher, G: Guard,

Source

pub fn set(&self) -> &'set HashSet<K, S>

Returns a reference to the inner HashSet.

Source

pub fn len(&self) -> usize

Returns the number of entries in the set.

See HashSet::len for details.

Source

pub fn is_empty(&self) -> bool

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

See HashSet::is_empty for details.

Source

pub fn contains<Q>(&self, key: &Q) -> bool
where Q: Equivalent<K> + Hash + ?Sized,

Returns true if the set contains a value for the specified key.

See HashSet::contains for details.

Source

pub fn get<Q>(&self, key: &Q) -> Option<&K>
where Q: Equivalent<K> + Hash + ?Sized,

Returns a reference to the value corresponding to the key.

See HashSet::get for details.

Source

pub fn insert(&self, key: K) -> bool

Inserts a key-value pair into the set.

See HashSet::insert for details.

Source

pub fn remove<Q>(&self, key: &Q) -> bool
where Q: Equivalent<K> + Hash + ?Sized,

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.

Source

pub fn clear(&self)

Clears the set, removing all values.

See HashSet::clear for details.

Source

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

Retains only the elements specified by the predicate.

See HashSet::retain for details.

Source

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.

Source

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.

Trait Implementations§

Source§

impl<K, S, G> Debug for HashSetRef<'_, K, S, G>
where K: Hash + Eq + Debug, S: BuildHasher, G: Guard,

Source§

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

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

impl<'a, K, S, G> IntoIterator for &'a HashSetRef<'_, K, S, G>
where K: Hash + Eq, S: BuildHasher, G: Guard,

Source§

type Item = &'a K

The type of the elements being iterated over.
Source§

type IntoIter = Iter<'a, K, G>

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

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more

Auto Trait Implementations§

§

impl<'set, K, S, G> Freeze for HashSetRef<'set, K, S, G>
where G: Freeze,

§

impl<'set, K, S, G> RefUnwindSafe for HashSetRef<'set, K, S, G>

§

impl<'set, K, S, G> Send for HashSetRef<'set, K, S, G>
where G: Send, K: Sync, S: Sync,

§

impl<'set, K, S, G> Sync for HashSetRef<'set, K, S, G>
where G: Sync, K: Sync, S: Sync,

§

impl<'set, K, S, G> Unpin for HashSetRef<'set, K, S, G>
where G: Unpin,

§

impl<'set, K, S, G> UnwindSafe for HashSetRef<'set, K, S, G>

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> 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, 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.