[−][src]Struct phreak_engine::datastructs::multiset::MultiSet
A multiset or 'bag' is a set where items can be added multiple times
Example: '<< 1,1,2,4,4,4 >>'
Implementation detail: this set drops the redundant items and keeps a reference count
Methods
impl<T> MultiSet<T> where
T: PartialEq + Eq + Hash,
[src]
T: PartialEq + Eq + Hash,
pub fn new() -> Self
[src]
pub fn with_capacity(capacity: usize) -> Self
[src]
pub fn capacity(&self) -> usize
[src]
Returns the number of unique items the set can hold without allocating
pub fn clear(&mut self)
[src]
Drop all items from the set
pub fn is_empty(&self) -> bool
[src]
Returns true if no items exist in the set
pub fn contains(&self, value: &T) -> bool
[src]
Returns true if the item occurs at least once
pub fn count(&self, value: &T) -> usize
[src]
Returns the number of occurrences of the given item in the set
pub fn insert(&mut self, value: T)
[src]
Insert an item to the set.
This method will drop the item if it already exists in the set, and increases the count instead, using reference counting instead of data duplication.
pub fn remove(&mut self, value: &T) -> bool
[src]
Removes an item from the set, and returns wetter it was present or not.
pub fn iter(&self) -> Iter<T>
[src]
Trait Implementations
Auto Trait Implementations
impl<T> RefUnwindSafe for MultiSet<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for MultiSet<T> where
T: Send,
T: Send,
impl<T> Sync for MultiSet<T> where
T: Sync,
T: Sync,
impl<T> Unpin for MultiSet<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for MultiSet<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,