pub struct MultiSet<T> { /* private fields */ }Expand description
A multiset of values of type T (any Ord + Clone).
Implementations§
Source§impl<T: Ord + Clone> MultiSet<T>
impl<T: Ord + Clone> MultiSet<T>
Sourcepub fn remove(&mut self, el: &T) -> bool
pub fn remove(&mut self, el: &T) -> bool
Remove one occurrence of el. Returns false if el was not present.
Sourcepub fn remove_all(&mut self, el: &T) -> bool
pub fn remove_all(&mut self, el: &T) -> bool
Remove all occurrences of el. Returns false if el was not present.
Sourcepub fn iter(&self) -> impl Iterator<Item = (&T, &usize)>
pub fn iter(&self) -> impl Iterator<Item = (&T, &usize)>
Iterate over (element, count) pairs in ascending order.
Sourcepub fn into_iter(self) -> impl Iterator<Item = (T, usize)>
pub fn into_iter(self) -> impl Iterator<Item = (T, usize)>
Consume the multiset and iterate over (element, count) pairs in
ascending order.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for MultiSet<T>
impl<T> RefUnwindSafe for MultiSet<T>where
T: RefUnwindSafe,
impl<T> Send for MultiSet<T>where
T: Send,
impl<T> Sync for MultiSet<T>where
T: Sync,
impl<T> Unpin for MultiSet<T>
impl<T> UnsafeUnpin for MultiSet<T>
impl<T> UnwindSafe for MultiSet<T>where
T: RefUnwindSafe,
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