pub struct UnorderedHashSet<Key: Hash + Eq>(_);
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: Hash + Eq> UnorderedHashSet<Key>
impl<Key: Hash + Eq> UnorderedHashSet<Key>
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 + Hash + Eq> Clone for UnorderedHashSet<Key>
impl<Key: Clone + Hash + Eq> Clone for UnorderedHashSet<Key>
source§fn clone(&self) -> UnorderedHashSet<Key>
fn clone(&self) -> UnorderedHashSet<Key>
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<Key: Hash + Eq> FromIterator<Key> for UnorderedHashSet<Key>
impl<Key: Hash + Eq> FromIterator<Key> for UnorderedHashSet<Key>
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<Key: PartialEq + Hash + Eq> PartialEq<UnorderedHashSet<Key>> for UnorderedHashSet<Key>
impl<Key: PartialEq + Hash + Eq> PartialEq<UnorderedHashSet<Key>> for UnorderedHashSet<Key>
source§fn eq(&self, other: &UnorderedHashSet<Key>) -> bool
fn eq(&self, other: &UnorderedHashSet<Key>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl<'a, Key: Hash + Eq + Clone> Sub<&'a UnorderedHashSet<Key>> for &'a UnorderedHashSet<Key>
impl<'a, Key: Hash + Eq + Clone> Sub<&'a UnorderedHashSet<Key>> for &'a UnorderedHashSet<Key>
impl<Key: Eq + Hash + Eq> Eq for UnorderedHashSet<Key>
impl<Key: Hash + Eq> StructuralEq for UnorderedHashSet<Key>
impl<Key: Hash + Eq> StructuralPartialEq for UnorderedHashSet<Key>
Auto Trait Implementations§
impl<Key> RefUnwindSafe for UnorderedHashSet<Key>where Key: RefUnwindSafe,
impl<Key> Send for UnorderedHashSet<Key>where Key: Send,
impl<Key> Sync for UnorderedHashSet<Key>where Key: Sync,
impl<Key> Unpin for UnorderedHashSet<Key>where Key: Unpin,
impl<Key> UnwindSafe for UnorderedHashSet<Key>where 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<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.