[][src]Struct phreak_engine::multiset::MultiSet

pub struct MultiSet<T> where
    T: PartialEq + Eq + Hash
{ /* fields omitted */ }

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]

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.

Important traits for Iter<'a, T>
pub fn iter(&self) -> Iter<T>[src]

Trait Implementations

impl<T: Debug> Debug for MultiSet<T> where
    T: PartialEq + Eq + Hash
[src]

Auto Trait Implementations

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> where
    T: Unpin

impl<T> UnwindSafe for MultiSet<T> where
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.