Skip to main content

Multiset

Struct Multiset 

Source
pub struct Multiset<V> { /* private fields */ }
Expand description

Multiset<V> is an abstract multiset type for specifications.

Multiset<V> can be encoded as a (total) map from elements to natural numbers, where the number of nonzero entries is finite.

Multisets can be constructed in a few different ways:

  • [Multiset::empty] constructs an empty multiset.
  • [Multiset::singleton] constructs a multiset that contains a single element with multiplicity 1.
  • [Multiset::from_map] constructs a multiset from a map of elements to multiplicities.
  • By manipulating existings multisets with [Multiset::add], [Multiset::insert], [Multiset::sub], [Multiset::remove], [Multiset::update], or [Multiset::filter].
  • TODO: multiset! constructor macro, multiset from set, from map, etc.

To prove that two multisets are equal, it is usually easiest to use the extensionality operator =~=.

Auto Trait Implementations§

§

impl<V> Freeze for Multiset<V>
where PhantomData<V>: Freeze,

§

impl<V> RefUnwindSafe for Multiset<V>

§

impl<V> Send for Multiset<V>
where PhantomData<V>: Send,

§

impl<V> Sync for Multiset<V>
where PhantomData<V>: Sync,

§

impl<V> Unpin for Multiset<V>
where PhantomData<V>: Unpin,

§

impl<V> UnsafeUnpin for Multiset<V>

§

impl<V> UnwindSafe for Multiset<V>

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

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 T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.