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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)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