pub struct MultiSet<T> {
    pub counter: FxHashMap<T, usize>,
    pub items: BTreeSet<(T, usize)>,
}

Fields§

§counter: FxHashMap<T, usize>§items: BTreeSet<(T, usize)>

Implementations§

source§

impl<T> MultiSet<T>where T: Ord + Hash + Copy,

source

pub fn new() -> Self

MultiSetを初期化する

source

pub fn insert(&mut self, x: T)

要素xを追加する

source

pub fn remove(&mut self, x: &T) -> bool

要素xを削除する

source

pub fn contains(&self, x: &T) -> bool

要素xが存在するか判定する

source

pub fn first(&self) -> Option<&T>

先頭の要素を取得する

source

pub fn last(&self) -> Option<&T>

末尾の要素を取得する

source

pub fn count(&self, x: &T) -> usize

xの個数をカウントする

source

pub fn clear(&mut self)

要素をすべて削除する

source

pub fn len(&self) -> usize

source

pub fn is_empty(&self) -> bool

source§

impl<T> MultiSet<T>

source

pub fn iter(&self) -> impl Iterator<Item = &T>

Trait Implementations§

source§

impl<T: Debug> Debug for MultiSet<T>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<T> Default for MultiSet<T>where T: Ord + Hash + Copy,

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<T: Ord + Hash + Copy> FromIterator<T> for MultiSet<T>

source§

fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self

Creates a value from an iterator. Read more

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 + RefUnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V