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>

source

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.

source

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.

source

pub fn extend<I: IntoIterator<Item = Key>>(&mut self, iter: I)

Extends the set with the content of the given iterator.

source

pub fn extend_unordered(&mut self, other: Self)

Extends the set with the content of another set.

source

pub fn contains<Q: ?Sized + Hash + Eq>(&self, value: &Q) -> boolwhere Key: Borrow<Q>,

Returns true if an equivalent to value exists in the set.

source

pub fn len(&self) -> usize

Returns the number of elements in the set.

source

pub fn is_empty(&self) -> bool

Returns true if the set contains no elements.

source

pub fn clear(&mut self)

Clears the set, removing all values.

Trait Implementations§

source§

impl<Key: Clone + Hash + Eq> Clone for UnorderedHashSet<Key>

source§

fn clone(&self) -> UnorderedHashSet<Key>

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<Key: Debug + Hash + Eq> Debug for UnorderedHashSet<Key>

source§

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

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

impl<Key: Hash + Eq> Default for UnorderedHashSet<Key>

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<Key: Hash + Eq> FromIterator<Key> for UnorderedHashSet<Key>

source§

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>

source§

fn eq(&self, other: &UnorderedHashSet<Key>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a, Key: Hash + Eq + Clone> Sub<&'a UnorderedHashSet<Key>> for &'a UnorderedHashSet<Key>

§

type Output = UnorderedHashSet<Key>

The resulting type after applying the - operator.
source§

fn sub(self, rhs: Self) -> Self::Output

Performs the - operation. Read more
source§

impl<Key: Eq + Hash + Eq> Eq for UnorderedHashSet<Key>

source§

impl<Key: Hash + Eq> StructuralEq for UnorderedHashSet<Key>

source§

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> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> DynClone for Twhere T: Clone,

source§

fn __clone_box(&self, _: Private) -> *mut ()

source§

impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

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

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere 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 Twhere T: Clone,

§

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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.
source§

impl<T> Upcast<T> for Twhere T: ?Sized,

source§

fn upcast(&self) -> &T

source§

impl<T> UpcastMut<T> for Twhere T: ?Sized,

source§

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