pub struct Multiset<T, S = DeterministicHasherBuilder> { /* private fields */ }Expand description
Multi-set of values.
Implementations§
Source§impl<T, S> Multiset<T, S>
impl<T, S> Multiset<T, S>
Sourcepub fn with_capacity(cap: usize) -> Selfwhere
S: Default,
pub fn with_capacity(cap: usize) -> Selfwhere
S: Default,
Creates a new Multiset with room for cap values.
Sourcepub fn contains(&self, value: &T) -> boolwhere
T: PartialEq,
pub fn contains(&self, value: &T) -> boolwhere
T: PartialEq,
Checks whether the multiset holds the given value.
Sourcepub fn iter(&self) -> Iter<'_, T> ⓘ
pub fn iter(&self) -> Iter<'_, T> ⓘ
Returns an iterator over the values of the multiset, in insertion order.
Source§impl<T: Hash, S: BuildHasher> Multiset<T, S>
impl<T: Hash, S: BuildHasher> Multiset<T, S>
Sourcepub fn insert(&mut self, value: T)
pub fn insert(&mut self, value: T)
Inserts a value. Duplicates are kept: inserting a value already present adds another occurrence of it.
Sourcepub fn insert_unique(&mut self, value: T) -> boolwhere
T: PartialEq,
pub fn insert_unique(&mut self, value: T) -> boolwhere
T: PartialEq,
Inserts the value only if it is not already present. Returns true
if it was inserted.
Trait Implementations§
impl<T: Eq, S> Eq for Multiset<T, S>
Source§impl<T: Hash, S: BuildHasher> Extend<T> for Multiset<T, S>
impl<T: Hash, S: BuildHasher> Extend<T> for Multiset<T, S>
Source§fn extend<I: IntoIterator<Item = T>>(&mut self, iter: I)
fn extend<I: IntoIterator<Item = T>>(&mut self, iter: I)
Extends a collection with the contents of an iterator. Read more
Source§fn extend_one(&mut self, item: T)
fn extend_one(&mut self, item: T)
🔬This is a nightly-only experimental API. (
extend_one)Extends a collection with exactly one element.
Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one)Reserves capacity in a collection for the given number of additional elements. Read more
Source§impl<T: Hash, S: Default + BuildHasher> FromIterator<T> for Multiset<T, S>
impl<T: Hash, S: Default + BuildHasher> FromIterator<T> for Multiset<T, S>
Source§fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self
Creates a value from an iterator. Read more
Source§impl<'a, T, S> IntoIterator for &'a Multiset<T, S>
impl<'a, T, S> IntoIterator for &'a Multiset<T, S>
Source§impl<'a, T, S> IntoIterator for &'a mut Multiset<T, S>
impl<'a, T, S> IntoIterator for &'a mut Multiset<T, S>
Source§impl<T, S> IntoIterator for Multiset<T, S>
impl<T, S> IntoIterator for Multiset<T, S>
Source§impl<T: IntoJsonWithContext<N>, S, N> IntoJsonWithContext<N> for Multiset<T, S>
impl<T: IntoJsonWithContext<N>, S, N> IntoJsonWithContext<N> for Multiset<T, S>
Auto Trait Implementations§
impl<T, S> Freeze for Multiset<T, S>
impl<T, S> RefUnwindSafe for Multiset<T, S>
impl<T, S> Send for Multiset<T, S>
impl<T, S> Sync for Multiset<T, S>
impl<T, S> Unpin for Multiset<T, S>
impl<T, S> UnsafeUnpin for Multiset<T, S>
impl<T, S> UnwindSafe for Multiset<T, S>
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> BorrowUnordered for T
impl<T> BorrowUnordered for T
Source§fn as_unordered(&self) -> &Unordered<T>
fn as_unordered(&self) -> &Unordered<T>
Views this value as an
Unordered reference.impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<I, C> CompactStringExt for C
impl<I, C> CompactStringExt for C
Source§fn concat_compact(self) -> CompactString
fn concat_compact(self) -> CompactString
Concatenates all the items of a collection into a
CompactString Read moreSource§fn join_compact<S>(self, separator: S) -> CompactString
fn join_compact<S>(self, separator: S) -> CompactString
Joins all the items of a collection, placing a separator between them, forming a
CompactString Read moreSource§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
Checks if
self is equivalent to key.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.