pub struct OrderedHashSet<Key, BH = RandomState>(/* private fields */);
Implementations§
Source§impl<Key, BH> OrderedHashSet<Key, BH>
impl<Key, BH> OrderedHashSet<Key, BH>
Source§impl<Key: Hash + Eq, BH> OrderedHashSet<Key, BH>
impl<Key: Hash + Eq, BH> OrderedHashSet<Key, BH>
Source§impl<Key: Hash + Eq, BH: BuildHasher> OrderedHashSet<Key, BH>
impl<Key: Hash + Eq, BH: BuildHasher> OrderedHashSet<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 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 contains<Q: ?Sized + Hash + Equivalent<Key>>(&self, value: &Q) -> bool
pub fn contains<Q: ?Sized + Hash + Equivalent<Key>>(&self, value: &Q) -> bool
Returns true if an equivalent to value exists in the set.
Sourcepub fn shift_remove<Q: ?Sized + Hash + Equivalent<Key>>(
&mut self,
value: &Q,
) -> bool
pub fn shift_remove<Q: ?Sized + Hash + Equivalent<Key>>( &mut self, value: &Q, ) -> bool
Removes the value from the set, preserving the order of elements.
Returns true if the value was present in the set.
Sourcepub fn swap_remove<Q: ?Sized + Hash + Equivalent<Key>>(
&mut self,
value: &Q,
) -> bool
pub fn swap_remove<Q: ?Sized + Hash + Equivalent<Key>>( &mut self, value: &Q, ) -> bool
Removes the value by swapping it with the last element, thus the order of elements is not preserved, but the resulting order is still deterministic.
Returns true if the value was present in the set.
pub fn difference<'a, S2>(
&'a self,
other: &'a OrderedHashSet<Key, S2>,
) -> Difference<'a, Key, S2>where
S2: BuildHasher,
Sourcepub fn is_subset<S2: BuildHasher>(
&self,
other: &OrderedHashSet<Key, S2>,
) -> bool
pub fn is_subset<S2: BuildHasher>( &self, other: &OrderedHashSet<Key, S2>, ) -> bool
Returns true
if all elements of self
are contained in other
.
Sourcepub fn is_superset<S2: BuildHasher>(
&self,
other: &OrderedHashSet<Key, S2>,
) -> bool
pub fn is_superset<S2: BuildHasher>( &self, other: &OrderedHashSet<Key, S2>, ) -> bool
Returns true
if all elements of other
are contained in self
.
Sourcepub fn union<'a, BH2: BuildHasher>(
&'a self,
other: &'a OrderedHashSet<Key, BH2>,
) -> Union<'a, Key, BH>
pub fn union<'a, BH2: BuildHasher>( &'a self, other: &'a OrderedHashSet<Key, BH2>, ) -> Union<'a, Key, BH>
Return an iterator over all values that are either in self
or other
.
Values from self
are produced in their original order, followed by
values that are unique to other
in their original order.
Trait Implementations§
Source§impl<Key: Clone, BH: Clone> Clone for OrderedHashSet<Key, BH>
impl<Key: Clone, BH: Clone> Clone for OrderedHashSet<Key, BH>
Source§fn clone(&self) -> OrderedHashSet<Key, BH>
fn clone(&self) -> OrderedHashSet<Key, BH>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl<Key, BH: Default> Default for OrderedHashSet<Key, BH>
impl<Key, BH: Default> Default for OrderedHashSet<Key, BH>
Source§impl<Key: Hash + Eq, BH: BuildHasher + Default> FromIterator<Key> for OrderedHashSet<Key, BH>
impl<Key: Hash + Eq, BH: BuildHasher + Default> FromIterator<Key> for OrderedHashSet<Key, BH>
Source§fn from_iter<T: IntoIterator<Item = Key>>(iter: T) -> Self
fn from_iter<T: IntoIterator<Item = Key>>(iter: T) -> Self
Source§impl<'a, Key, BH> IntoIterator for &'a OrderedHashSet<Key, BH>
impl<'a, Key, BH> IntoIterator for &'a OrderedHashSet<Key, BH>
Source§impl<Key, BH> IntoIterator for OrderedHashSet<Key, BH>
impl<Key, BH> IntoIterator for OrderedHashSet<Key, BH>
Source§impl<Key: Eq, BH> PartialEq for OrderedHashSet<Key, BH>
impl<Key: Eq, BH> PartialEq for OrderedHashSet<Key, BH>
Source§impl<'a, Key, BH> Sub for &'a OrderedHashSet<Key, BH>
impl<'a, Key, BH> Sub for &'a OrderedHashSet<Key, BH>
impl<Key: Eq, BH> Eq for OrderedHashSet<Key, BH>
Auto Trait Implementations§
impl<Key, BH> Freeze for OrderedHashSet<Key, BH>where
BH: Freeze,
impl<Key, BH> RefUnwindSafe for OrderedHashSet<Key, BH>where
BH: RefUnwindSafe,
Key: RefUnwindSafe,
impl<Key, BH> Send for OrderedHashSet<Key, BH>
impl<Key, BH> Sync for OrderedHashSet<Key, BH>
impl<Key, BH> Unpin for OrderedHashSet<Key, BH>
impl<Key, BH> UnwindSafe for OrderedHashSet<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
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
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>
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>
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