pub struct UnorderedHashSet<Key, BH = RandomState>(/* private fields */);
Expand description
A hash set that does not care about the order of insertion.
In particular, it does not support iterating, in order to guarantee deterministic compilation. For an iterable version see OrderedHashSet.
Implementations§
Source§impl<Key, BH> UnorderedHashSet<Key, BH>
impl<Key, BH> UnorderedHashSet<Key, BH>
Source§impl<Key: Hash + Eq, BH: BuildHasher> UnorderedHashSet<Key, BH>
impl<Key: Hash + Eq, BH: BuildHasher> UnorderedHashSet<Key, BH>
Sourcepub fn insert(&mut self, key: Key) -> bool
pub fn insert(&mut self, key: Key) -> bool
Inserts the value into the set.
If an equivalent item already exists in the set, returns false
. Otherwise, returns true
.
Sourcepub fn remove<Q: ?Sized + Hash + Eq>(&mut self, value: &Q) -> boolwhere
Key: Borrow<Q>,
pub fn remove<Q: ?Sized + Hash + Eq>(&mut self, value: &Q) -> boolwhere
Key: Borrow<Q>,
Removes a value from the set. Returns whether the value was present in the set.
Sourcepub fn extend<I: IntoIterator<Item = Key>>(&mut self, iter: I)
pub fn extend<I: IntoIterator<Item = Key>>(&mut self, iter: I)
Extends the set with the content of the given iterator.
Sourcepub fn extend_unordered(&mut self, other: Self)
pub fn extend_unordered(&mut self, other: Self)
Extends the set with the content of another set.
Trait Implementations§
Source§impl<Key: Clone, BH: Clone> Clone for UnorderedHashSet<Key, BH>
impl<Key: Clone, BH: Clone> Clone for UnorderedHashSet<Key, BH>
Source§fn clone(&self) -> UnorderedHashSet<Key, BH>
fn clone(&self) -> UnorderedHashSet<Key, BH>
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<K, BH: Default> Default for UnorderedHashSet<K, BH>
impl<K, BH: Default> Default for UnorderedHashSet<K, BH>
Source§impl<Key: Hash + Eq, BH: BuildHasher + Default> FromIterator<Key> for UnorderedHashSet<Key, BH>
impl<Key: Hash + Eq, BH: BuildHasher + Default> FromIterator<Key> for UnorderedHashSet<Key, BH>
Source§fn from_iter<T: IntoIterator<Item = Key>>(iter: T) -> Self
fn from_iter<T: IntoIterator<Item = Key>>(iter: T) -> Self
Creates a value from an iterator. Read more
Source§impl<K, BH> PartialEq for UnorderedHashSet<K, BH>
impl<K, BH> PartialEq for UnorderedHashSet<K, BH>
Source§impl<'a, Key, BH> Sub for &'a UnorderedHashSet<Key, BH>
impl<'a, Key, BH> Sub for &'a UnorderedHashSet<Key, BH>
impl<K, BH> Eq for UnorderedHashSet<K, BH>
Auto Trait Implementations§
impl<Key, BH> Freeze for UnorderedHashSet<Key, BH>where
BH: Freeze,
impl<Key, BH> RefUnwindSafe for UnorderedHashSet<Key, BH>where
BH: RefUnwindSafe,
Key: RefUnwindSafe,
impl<Key, BH> Send for UnorderedHashSet<Key, BH>
impl<Key, BH> Sync for UnorderedHashSet<Key, BH>
impl<Key, BH> Unpin for UnorderedHashSet<Key, BH>
impl<Key, BH> UnwindSafe for UnorderedHashSet<Key, BH>where
BH: UnwindSafe,
Key: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more