Struct utote::Multiset[][src]

pub struct Multiset<N: Counter, const SIZE: usize> { /* fields omitted */ }

A stack allocated multiset of unsigned integers.

Each index in the Multiset array corresponds to an element in the multiset. If the value at an index is 0 then there are no instances of the corresponding uint in the multiset. Because of this correspondence the order of the counts must remain consistent for any Multiset to behave consistently.

Examples

use utote::Multiset;

// A multiset of 5 elements, which can be counted up to u8::MAX
let mut multiset = Multiset::from([0u8, 3, 4, 0, 5]);
assert_eq!(multiset.total(), 12);

let equivalent_multiset = Multiset::<u8, 5>::from([0, 3, 4, 0, 5]);
assert_eq!(multiset, equivalent_multiset);

multiset.insert(2, 6);
assert_eq!(multiset, Multiset::from([0, 3, 6, 0, 5]));

for elem in multiset.iter() {
    println!("{}", elem);
}

assert_eq!(multiset.contains(0), false);
assert_eq!(multiset.contains(1), true);

Some common set-like operations:

use utote::Multiset;

let ms_sub: Multiset<u32, 3> = Multiset::from([0, 1, 1]);
let ms_super = Multiset::from([1, 1, 2]);

assert_eq!(ms_sub.is_subset(&ms_super), true);

assert_eq!(ms_sub.union(&ms_super), Multiset::from([1, 1, 2]));

assert_eq!(ms_super.is_proper_superset(&ms_sub), true);

// Any multiset where all counters are zero is equivalent to
// the empty multiset.
let empty: Multiset<u64, 2> = Multiset::from([0, 0]);
assert_eq!(empty, Multiset::empty());

Indexing

The Multiset type allows accessing values by index in the same manner that Vec does.

use utote::Multiset;
let multiset = Multiset::from([1u16, 2, 3]);
println!("{}", multiset[1]); // it will display '2'

As with slice, get and get_mut are provided (along with unchecked versions).

Using Generically

The Counter trait is provided to simplify using Multiset generically. Counter is implemented for all unsigned integers.

use utote::{Counter, Multiset};

fn generic_ms<T: Counter, const SIZE: usize>(ms: Multiset<T, SIZE>) {
    println!("{}", ms.is_empty());
}

Implementations

impl<N: Counter, const SIZE: usize> Multiset<N, SIZE>[src]

pub const SIZE: usize[src]

The number of elements in the multiset.

pub fn len() -> usize[src]

Returns the number of elements in the multiset.

pub fn new(data: [N; SIZE]) -> Multiset<N, SIZE>[src]

Constructs a new Multiset.

This method is equivalent to calling Multiset::from with an array of the correct type.

Examples

use utote::Multiset;

let multiset = Multiset::new([1u8, 2, 3, 4]);
let multiset_from = Multiset::from([1, 2, 3, 4]);
assert_eq!(multiset, multiset_from);

pub fn empty() -> Self[src]

Returns a Multiset of the given array size with all element counts set to zero.

Multiset::default will also construct an empty set.

Examples

use utote::Multiset;

let empty_multiset = Multiset::<u8, 4>::empty();
assert_eq!(empty_multiset, Multiset::from([0, 0, 0, 0]));
assert_eq!(empty_multiset, Multiset::default());

pub fn repeat(count: N) -> Self[src]

Returns a Multiset of the given array size with all elements set to count.

Examples

use utote::Multiset;

let multiset = Multiset::<u8, 4>::repeat(5);
assert_eq!(multiset, Multiset::from([5, 5, 5, 5]))

pub fn from_elements<'a, I>(elements: I) -> Self where
    I: IntoIterator<Item = &'a usize>, 
[src]

Constructs a Multiset from an iterator of elements in the multiset, incrementing the count of each element as it occurs in the iterator.

Panics

If any item in the iterator is out of bounds of the Multiset.

Examples

use utote::Multiset;

let multiset = Multiset::<u8, 4>::from_elements(&[1, 1, 0, 2, 2, 2]);
assert_eq!(multiset, Multiset::from([1, 2, 3, 0]))

pub fn iter(&self) -> Iter<'_, N>[src]

Return an Iter of the element counts in the Multiset.

pub fn iter_mut(&mut self) -> IterMut<'_, N>[src]

Return a IterMut of the element counts in the Multiset.

pub fn clear(&mut self)[src]

Sets all element counts in the multiset to zero.

Examples

use utote::Multiset;

let mut multiset = Multiset::<u8, 4>::from([1, 2, 3, 4]);
multiset.clear();
assert_eq!(multiset.is_empty(), true);

pub fn contains(&self, elem: usize) -> bool[src]

Returns true if elem has count > 0 in the multiset.

Examples

use utote::Multiset;

let multiset = Multiset::from([1u8, 2, 0, 0]);
assert_eq!(multiset.contains(1), true);
assert_eq!(multiset.contains(3), false);
assert_eq!(multiset.contains(5), false);

pub unsafe fn contains_unchecked(&self, elem: usize) -> bool[src]

Returns true if elem has count > 0 in the multiset, without doing bounds checking.

For a safe alternative see contains.

Safety

Calling this method with an out-of-bounds index is undefined behavior even if the resulting boolean is not used.

Examples

use utote::Multiset;

let multiset = Multiset::from([1u8, 2, 0, 0]);

unsafe {
    assert_eq!(multiset.contains_unchecked(1), true);
    assert_eq!(multiset.contains_unchecked(3), false);
}

pub fn insert(&mut self, elem: usize, amount: N)[src]

Set the count of elem in the multiset to amount.

Examples

use utote::Multiset;

let mut multiset = Multiset::from([1u8, 2, 0, 0]);
multiset.insert(2, 5);
assert_eq!(multiset.get(2), Some(&5));

pub unsafe fn insert_unchecked(&mut self, elem: usize, amount: N)[src]

Set the count of elem in the multiset to amount, without doing bounds checking.

For a safe alternative see insert.

Safety

Calling this method with an out-of-bounds index is undefined behavior.

Examples

use utote::Multiset;

let mut multiset = Multiset::from([1u8, 2, 0, 0]);

unsafe {
    multiset.insert_unchecked(2, 5);
   assert_eq!(multiset.get(2), Some(&5));
}

pub fn remove(&mut self, elem: usize)[src]

Set the count of elem in the multiset to zero.

Examples

use utote::Multiset;

let mut multiset = Multiset::from([1u8, 2, 0, 0]);
multiset.remove(1);
assert_eq!(multiset.get(1), Some(&0));

pub unsafe fn remove_unchecked(&mut self, elem: usize)[src]

Set the count of elem in the multiset to zero, without doing bounds checking.

For a safe alternative see remove.

Safety

Calling this method with an out-of-bounds index is undefined behavior.

Examples

use utote::Multiset;

let mut multiset = Multiset::from([1u8, 2, 0, 0]);
unsafe {
    multiset.remove_unchecked(1);
    assert_eq!(multiset.get(1), Some(&0));
}

pub fn get<I>(&self, index: I) -> Option<&I::Output> where
    I: SliceIndex<[N]>, 
[src]

Returns a reference to a count or subslice of counts depending on the type of index.

  • If given a position, returns a reference to the count at that position or None if out of bounds.
  • If given a range, returns the subslice corresponding to that range, or None if out of bounds.

Examples

use utote::Multiset;

let multiset = Multiset::from([1u8, 2, 0, 0]);
assert_eq!(multiset.get(1), Some(&2));
assert_eq!(multiset.get(2..), Some(&[0, 0][..]));
assert_eq!(multiset.get(5), None);
assert_eq!(multiset.get(0..5), None);

pub fn get_mut<I>(&mut self, index: I) -> Option<&mut I::Output> where
    I: SliceIndex<[N]>, 
[src]

Returns a mutable reference to a count or subslice of counts depending on the type of index (see get) or None if the index is out of bounds.

Examples

use utote::Multiset;

let mut multiset = Multiset::from([1u8, 2, 4]);

if let Some(elem) = multiset.get_mut(1) {
    *elem = 42;
}
assert_eq!(multiset, Multiset::from([1u8, 42, 4]));

pub unsafe fn get_unchecked<I>(&self, index: I) -> &I::Output where
    I: SliceIndex<[N]>, 
[src]

Returns a reference to a count or subslice of counts, without doing bounds checking.

For a safe alternative see get.

Safety

Calling this method with an out-of-bounds index is undefined behavior even if the resulting reference is not used.

Examples

use utote::Multiset;

let multiset = Multiset::from([1u32, 2, 0, 0]);

unsafe {
    assert_eq!(multiset.get_unchecked(1), &2);
}

pub unsafe fn get_unchecked_mut<I>(&mut self, index: I) -> &mut I::Output where
    I: SliceIndex<[N]>, 
[src]

Returns a mutable reference to a count or subslice of counts, without doing bounds checking.

For a safe alternative see get_mut.

Safety

Calling this method with an out-of-bounds index is undefined behavior even if the resulting reference is not used.

Examples

use utote::Multiset;

let mut multiset = Multiset::from([1u8, 2, 4]);

unsafe {
    let elem = multiset.get_unchecked_mut(1);
    *elem = 13;
}
assert_eq!(multiset, Multiset::from([1u8, 13, 4]));

pub fn intersection(&self, other: &Self) -> Self[src]

Returns a multiset which is the intersection of self and other.

The Intersection of two multisets is the counts of elements which occurs in both. A intersection B is the multiset C where C[i] == min(A[i], B[i]) for all i in C.

Examples

use utote::Multiset;

let a = Multiset::from([1u8, 2, 0, 0]);
let b = Multiset::from([0, 1, 3, 0]);
let c = Multiset::from([0, 1, 0, 0]);
assert_eq!(a.intersection(&b), c);

pub fn union(&self, other: &Self) -> Self[src]

Returns a multiset which is the union of self and other.

The union of two multisets is the counts of elements which occur in either, without repeats. A union B is the multiset C where C[i] == max(A[i], B[i]) for all i in C.

Examples

use utote::Multiset;

let a = Multiset::from([1u8, 2, 0, 0]);
let b = Multiset::from([0, 1, 3, 0]);
let c = Multiset::from([1, 2, 3, 0]);
assert_eq!(a.union(&b), c);

pub fn difference(&self, other: &Self) -> Self[src]

Returns a multiset which is the difference of self and other.

The difference of this multiset and another is the count of elements in this and those that occur in this and other without repeats. A difference B is the multiset C where C[i] == min(A[i], B[i]) if A[i] > 0 and B[i] > 0, otherwise A[i] for all i in C.

Examples

use utote::Multiset;

let a = Multiset::from([1u8, 2, 0, 0]);
let b = Multiset::from([0, 1, 3, 0]);
let c = Multiset::from([1, 1, 0, 0]);
assert_eq!(a.difference(&b), c);

pub fn symmetric_difference(&self, other: &Self) -> Self[src]

Returns a multiset which is the symmetric_difference of self and other.

The symmetric_difference of two multisets is the count of elements that occur in either, and the count, without repeats that occurs in both. A symmetric_difference B is the multiset C where C[i] == min(A[i], B[i]) if A[i] > 0 and B[i] > 0, otherwise max(A[i], B[i]) for all i in C.

Examples

use utote::Multiset;

let a = Multiset::from([1u8, 2, 0, 0]);
let b = Multiset::from([0, 1, 3, 0]);
let c = Multiset::from([1, 1, 3, 0]);
assert_eq!(a.symmetric_difference(&b), c);

pub fn count_non_zero(&self) -> usize[src]

Returns the number of elements whose count is non-zero.

Examples

use utote::Multiset;

let multiset = Multiset::from([1u8, 0, 0, 0]);
assert_eq!(multiset.count_non_zero(), 1);

pub fn count_zero(&self) -> usize[src]

Returns the number of elements whose count is zero.

Examples

use utote::Multiset;

let multiset = Multiset::from([1u8, 0, 0, 0]);
assert_eq!(multiset.count_zero(), 3);

pub fn is_singleton(&self) -> bool[src]

Returns true if only one element in the multiset has a non-zero count.

Examples

use utote::Multiset;

let multiset = Multiset::from([0u8, 5, 0, 0]);
assert_eq!(multiset.is_singleton(), true);

pub fn is_disjoint(&self, other: &Self) -> bool[src]

Returns true if self is disjoint to other.

Multiset A is disjoint to B if A has no elements in common with B. A is disjoint B if min(A[i], B[i]) == 0 for all i in A.

Examples

use utote::Multiset;

let a = Multiset::from([1u8, 2, 0, 0]);
assert_eq!(a.is_disjoint(&a), false);

let b = Multiset::from([0, 0, 3, 4]);
assert_eq!(a.is_disjoint(&b), true);

let c = Multiset::from([0, 1, 1, 0]);
assert_eq!(a.is_disjoint(&c), false);

pub fn is_subset(&self, other: &Self) -> bool[src]

Returns true if self is a subset of other.

Multiset A is a subset of B if all the element counts in A are less than or equal to the counts in B. A is subset B if A[i] <= B[i] for all i in A.

Examples

use utote::Multiset;

let a = Multiset::from([1u64, 2, 0, 0]);
assert_eq!(a.is_subset(&a), true);

let b = Multiset::from([1, 3, 0, 0]);
assert_eq!(a.is_subset(&b), true);

assert_eq!(a.is_subset(&Multiset::empty()), false);

pub fn is_superset(&self, other: &Self) -> bool[src]

Returns true if self is a superset of other.

Multiset A is a subset of B if all the element counts in A are greater than or equal to the counts in B. A is superset B if A[i] >= B[i] for all i in A.

Examples

use utote::Multiset;

let a = Multiset::from([1u8, 2, 0, 0]);
assert_eq!(a.is_superset(&a), true);

let b = Multiset::from([1, 1, 0, 0]);
assert_eq!(a.is_superset(&b), true);

assert_eq!(a.is_superset(&Multiset::empty()), true);

pub fn is_proper_subset(&self, other: &Self) -> bool[src]

Returns true if self is a proper subset of other.

Multiset A is a proper subset of B if A is a subset of B and at least one element count of A is less than that element count in B. A is proper subset B if A[i] <= B[i] for all i in A and there exists j such that A[j] < B[j].

Examples

use utote::Multiset;

let a = Multiset::from([1u8, 2, 0, 0]);
assert_eq!(a.is_proper_subset(&a), false);

let b = Multiset::from([1, 3, 0, 0]);
assert_eq!(a.is_proper_subset(&b), true);

pub fn is_proper_superset(&self, other: &Self) -> bool[src]

Returns true if self is a proper superset of other.

Multiset A is a proper superset of B if A is a superset of B and at least one element count of A is greater than that element count in B. A is proper superset B if A[i] >= B[i] for all i in A and there exists j such that A[j] > B[j].

Examples

use utote::Multiset;

let a = Multiset::from([1u8, 2, 0, 0]);
assert_eq!(a.is_proper_superset(&a), false);

let b = Multiset::from([1, 1, 0, 0]);
assert_eq!(a.is_proper_superset(&b), true);

pub fn is_any_lesser(&self, other: &Self) -> bool[src]

Returns true if any element count in self is less than that element count in other.

A is any lesser B if there exists some i such that A[i] < B[i].

Examples

use utote::Multiset;

let a = Multiset::from([1u8, 2, 4, 0]);
assert_eq!(a.is_any_lesser(&a), false);

let b = Multiset::from([1, 3, 0, 0]);
assert_eq!(a.is_any_lesser(&b), true);

pub fn is_any_greater(&self, other: &Self) -> bool[src]

Returns true if any element count in self is greater than that element count in other.

A is any greater B if there exists some i such that A[i] > B[i].

Examples

use utote::Multiset;

let a = Multiset::from([1u8, 2, 0, 0]);
assert_eq!(a.is_any_greater(&a), false);

let b = Multiset::from([1, 1, 4, 0]);
assert_eq!(a.is_any_greater(&b), true);

pub fn is_empty(&self) -> bool[src]

Returns true if all elements have a count of zero.

Examples

use utote::Multiset;

let multiset = Multiset::from([0u8, 0, 0, 0]);
assert_eq!(multiset.is_empty(), true);
assert_eq!(Multiset::<u8, 4>::empty().is_empty(), true);

pub fn total(&self) -> usize[src]

The total or cardinality of a multiset is the sum of all element counts.

This function converts counts to usize to try and avoid overflows.

Examples

use utote::Multiset;

let multiset = Multiset::from([1u8, 2, 3, 4]);
assert_eq!(multiset.total(), 10);

pub fn elem_count_max(&self) -> (usize, &N)[src]

Returns a tuple containing the element and a reference to the largest count in the multiset.

Examples

use utote::Multiset;

let multiset = Multiset::from([2u16, 0, 5, 3]);
assert_eq!(multiset.elem_count_max(), (2, &5));

pub fn elem_max(&self) -> usize[src]

Returns the element with the largest count in the multiset.

Examples

use utote::Multiset;

let multiset = Multiset::from([2u8, 0, 5, 3]);
assert_eq!(multiset.elem_max(), 2);

pub fn count_max(&self) -> &N[src]

Returns a reference to the largest count in the multiset.

Examples

use utote::Multiset;

let multiset = Multiset::from([2u8, 0, 5, 3]);
assert_eq!(multiset.count_max(), &5);

pub fn elem_count_min(&self) -> (usize, &N)[src]

Returns a tuple containing the element and a reference to the smallest count in the multiset.

Examples

use utote::Multiset;

let multiset = Multiset::from([2u8, 0, 5, 3]);
assert_eq!(multiset.elem_count_min(), (1, &0));

pub fn elem_min(&self) -> usize[src]

Returns the element with the smallest count in the multiset.

Examples

use utote::Multiset;

let multiset = Multiset::from([2u8, 0, 5, 3]);
assert_eq!(multiset.elem_min(), 1);

pub fn count_min(&self) -> &N[src]

Returns a reference to the smallest count in the multiset.

Examples

use utote::Multiset;

let multiset = Multiset::from([2u8, 0, 5, 3]);
assert_eq!(multiset.count_min(), &0);

pub fn choose(&mut self, elem: usize)[src]

Set all element counts, except for the given elem, to zero.

Examples

use utote::Multiset;

let mut multiset = Multiset::from([2u8, 0, 5, 3]);
multiset.choose(2);
let result = Multiset::from([0, 0, 5, 0]);
assert_eq!(multiset, result);

pub fn choose_random<T: RngCore>(&mut self, rng: &mut T)[src]

Set all element counts, except for a random choice, to zero.

The choice is weighted by the counts of the elements, and unless the multiset is empty an element with non-zero count will always be chosen.

Examples

use utote::Multiset;
use rand::prelude::*;

let rng = &mut StdRng::seed_from_u64(thread_rng().next_u64());
let mut multiset = Multiset::from([2u8, 0, 5, 3]);
multiset.choose_random(rng);
assert_eq!(multiset.is_singleton(), true);

pub fn collision_entropy(&self) -> f64[src]

Calculate the collision entropy of the multiset.

Examples

use utote::Multiset;

let multiset = Multiset::from([2u8, 1, 1, 0]);
let result = multiset.collision_entropy();
// approximate: result == 1.415037499278844

Warning

Should not be used if Multiset::total or any counter in the multiset cannot be converted to f64. The conversions are handled by AsPrimitive<f64>.

pub fn shannon_entropy(&self) -> f64[src]

Calculate the shannon entropy of the multiset. Uses ln rather than log2.

Examples

use utote::Multiset;

let multiset = Multiset::from([2u8, 1, 1, 0]);
let result = multiset.shannon_entropy();
// approximate: result == 1.0397207708399179

Warning

Should not be used if Multiset::total or any counter in the multiset cannot be converted to f64. The conversions are handled by AsPrimitive<f64>.

Trait Implementations

impl<N: Counter, const SIZE: usize> Add<Multiset<N, SIZE>> for Multiset<N, SIZE>[src]

type Output = Multiset<N, SIZE>

The resulting type after applying the + operator.

fn add(self, rhs: Self) -> Self::Output[src]

Performs the + operation. Read more

impl<N: Counter, const SIZE: usize> Add<N> for Multiset<N, SIZE>[src]

type Output = Multiset<N, SIZE>

The resulting type after applying the + operator.

fn add(self, rhs: N) -> Self::Output[src]

Performs the + operation. Read more

impl<N: Counter, const SIZE: usize> AddAssign<Multiset<N, SIZE>> for Multiset<N, SIZE>[src]

fn add_assign(&mut self, rhs: Self)[src]

Performs the += operation. Read more

impl<N: Counter, const SIZE: usize> AddAssign<N> for Multiset<N, SIZE>[src]

fn add_assign(&mut self, rhs: N)[src]

Performs the += operation. Read more

impl<N: Counter, const SIZE: usize> Clone for Multiset<N, SIZE>[src]

fn clone(&self) -> Self[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<N: Counter, const SIZE: usize> Debug for Multiset<N, SIZE>[src]

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

Formats the value using the given formatter. Read more

impl<N: Counter, const SIZE: usize> Default for Multiset<N, SIZE>[src]

fn default() -> Self[src]

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

impl<N: Counter, const SIZE: usize> Div<Multiset<N, SIZE>> for Multiset<N, SIZE>[src]

type Output = Multiset<N, SIZE>

The resulting type after applying the / operator.

fn div(self, rhs: Self) -> Self::Output[src]

Performs the / operation. Read more

impl<N: Counter, const SIZE: usize> Div<N> for Multiset<N, SIZE>[src]

type Output = Multiset<N, SIZE>

The resulting type after applying the / operator.

fn div(self, rhs: N) -> Self::Output[src]

Performs the / operation. Read more

impl<N: Counter, const SIZE: usize> DivAssign<Multiset<N, SIZE>> for Multiset<N, SIZE>[src]

fn div_assign(&mut self, rhs: Self)[src]

Performs the /= operation. Read more

impl<N: Counter, const SIZE: usize> DivAssign<N> for Multiset<N, SIZE>[src]

fn div_assign(&mut self, rhs: N)[src]

Performs the /= operation. Read more

impl<N: Counter, const SIZE: usize> From<&'_ [N; SIZE]> for Multiset<N, SIZE>[src]

fn from(data: &[N; SIZE]) -> Self[src]

Performs the conversion.

impl<N: Counter, const SIZE: usize> From<&'_ [N]> for Multiset<N, SIZE>[src]

fn from(slice: &[N]) -> Self[src]

Performs the conversion.

impl<N: Counter, const SIZE: usize> From<[N; SIZE]> for Multiset<N, SIZE>[src]

fn from(data: [N; SIZE]) -> Self[src]

Performs the conversion.

impl<'a, N: 'a + Counter, const SIZE: usize> FromIterator<&'a N> for Multiset<N, SIZE>[src]

fn from_iter<T: IntoIterator<Item = &'a N>>(iter: T) -> Self[src]

Creates a value from an iterator. Read more

impl<N: Counter, const SIZE: usize> FromIterator<N> for Multiset<N, SIZE>[src]

fn from_iter<T: IntoIterator<Item = N>>(iter: T) -> Self[src]

Creates a value from an iterator. Read more

impl<N: Counter, const SIZE: usize> Hash for Multiset<N, SIZE>[src]

fn hash<H: Hasher>(&self, state: &mut H)[src]

Feeds this value into the given Hasher. Read more

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0[src]

Feeds a slice of this type into the given Hasher. Read more

impl<N: Counter, I: SliceIndex<[N]>, const SIZE: usize> Index<I> for Multiset<N, SIZE>[src]

type Output = I::Output

The returned type after indexing.

fn index(&self, index: I) -> &Self::Output[src]

Performs the indexing (container[index]) operation. Read more

impl<N: Counter, I: SliceIndex<[N]>, const SIZE: usize> IndexMut<I> for Multiset<N, SIZE>[src]

fn index_mut(&mut self, index: I) -> &mut Self::Output[src]

Performs the mutable indexing (container[index]) operation. Read more

impl<N: Counter, const SIZE: usize> IntoIterator for Multiset<N, SIZE>[src]

type Item = N

The type of the elements being iterated over.

type IntoIter = IntoIter<N, SIZE>

Which kind of iterator are we turning this into?

fn into_iter(self) -> Self::IntoIter[src]

Creates an iterator from a value. Read more

impl<'a, N: Counter, const SIZE: usize> IntoIterator for &'a Multiset<N, SIZE>[src]

type Item = &'a N

The type of the elements being iterated over.

type IntoIter = Iter<'a, N>

Which kind of iterator are we turning this into?

fn into_iter(self) -> Self::IntoIter[src]

Creates an iterator from a value. Read more

impl<'a, N: Counter, const SIZE: usize> IntoIterator for &'a mut Multiset<N, SIZE>[src]

type Item = &'a mut N

The type of the elements being iterated over.

type IntoIter = IterMut<'a, N>

Which kind of iterator are we turning this into?

fn into_iter(self) -> Self::IntoIter[src]

Creates an iterator from a value. Read more

impl<N: Counter, const SIZE: usize> Mul<Multiset<N, SIZE>> for Multiset<N, SIZE>[src]

type Output = Multiset<N, SIZE>

The resulting type after applying the * operator.

fn mul(self, rhs: Self) -> Self::Output[src]

Performs the * operation. Read more

impl<N: Counter, const SIZE: usize> Mul<N> for Multiset<N, SIZE>[src]

type Output = Multiset<N, SIZE>

The resulting type after applying the * operator.

fn mul(self, rhs: N) -> Self::Output[src]

Performs the * operation. Read more

impl<N: Counter, const SIZE: usize> MulAssign<Multiset<N, SIZE>> for Multiset<N, SIZE>[src]

fn mul_assign(&mut self, rhs: Self)[src]

Performs the *= operation. Read more

impl<N: Counter, const SIZE: usize> MulAssign<N> for Multiset<N, SIZE>[src]

fn mul_assign(&mut self, rhs: N)[src]

Performs the *= operation. Read more

impl<N: Counter, const SIZE: usize> PartialEq<Multiset<N, SIZE>> for Multiset<N, SIZE>[src]

fn eq(&self, other: &Self) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests for !=.

impl<N: Counter, const SIZE: usize> PartialOrd<Multiset<N, SIZE>> for Multiset<N, SIZE>[src]

Partial order based on proper sub/super sets

fn partial_cmp(&self, other: &Self) -> Option<Ordering>[src]

This method returns an ordering between self and other values if one exists. Read more

fn lt(&self, other: &Self) -> bool[src]

This method tests less than (for self and other) and is used by the < operator. Read more

fn le(&self, other: &Self) -> bool[src]

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

fn gt(&self, other: &Self) -> bool[src]

This method tests greater than (for self and other) and is used by the > operator. Read more

fn ge(&self, other: &Self) -> bool[src]

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl<N: Counter, const SIZE: usize> Rem<Multiset<N, SIZE>> for Multiset<N, SIZE>[src]

type Output = Multiset<N, SIZE>

The resulting type after applying the % operator.

fn rem(self, rhs: Self) -> Self::Output[src]

Performs the % operation. Read more

impl<N: Counter, const SIZE: usize> Rem<N> for Multiset<N, SIZE>[src]

type Output = Multiset<N, SIZE>

The resulting type after applying the % operator.

fn rem(self, rhs: N) -> Self::Output[src]

Performs the % operation. Read more

impl<N: Counter, const SIZE: usize> RemAssign<Multiset<N, SIZE>> for Multiset<N, SIZE>[src]

fn rem_assign(&mut self, rhs: Self)[src]

Performs the %= operation. Read more

impl<N: Counter, const SIZE: usize> RemAssign<N> for Multiset<N, SIZE>[src]

fn rem_assign(&mut self, rhs: N)[src]

Performs the %= operation. Read more

impl<N: Counter, const SIZE: usize> Sub<Multiset<N, SIZE>> for Multiset<N, SIZE>[src]

type Output = Multiset<N, SIZE>

The resulting type after applying the - operator.

fn sub(self, rhs: Self) -> Self::Output[src]

Performs the - operation. Read more

impl<N: Counter, const SIZE: usize> Sub<N> for Multiset<N, SIZE>[src]

type Output = Multiset<N, SIZE>

The resulting type after applying the - operator.

fn sub(self, rhs: N) -> Self::Output[src]

Performs the - operation. Read more

impl<N: Counter, const SIZE: usize> SubAssign<Multiset<N, SIZE>> for Multiset<N, SIZE>[src]

fn sub_assign(&mut self, rhs: Self)[src]

Performs the -= operation. Read more

impl<N: Counter, const SIZE: usize> SubAssign<N> for Multiset<N, SIZE>[src]

fn sub_assign(&mut self, rhs: N)[src]

Performs the -= operation. Read more

impl<N: Counter, const SIZE: usize> Copy for Multiset<N, SIZE>[src]

impl<N: Counter, const SIZE: usize> Eq for Multiset<N, SIZE>[src]

Auto Trait Implementations

impl<N, const SIZE: usize> RefUnwindSafe for Multiset<N, SIZE> where
    N: RefUnwindSafe

impl<N, const SIZE: usize> Send for Multiset<N, SIZE> where
    N: Send

impl<N, const SIZE: usize> Sync for Multiset<N, SIZE> where
    N: Sync

impl<N, const SIZE: usize> Unpin for Multiset<N, SIZE> where
    N: Unpin

impl<N, const SIZE: usize> UnwindSafe for Multiset<N, SIZE> where
    N: UnwindSafe

Blanket Implementations

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

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

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

pub fn from(t: T) -> T[src]

Performs the conversion.

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

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

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.

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

Performs the conversion.

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.

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

Performs the conversion.

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

pub fn vzip(self) -> V

impl<T, Rhs> NumAssignOps<Rhs> for T where
    T: AddAssign<Rhs> + SubAssign<Rhs> + MulAssign<Rhs> + DivAssign<Rhs> + RemAssign<Rhs>, 
[src]

impl<T, Rhs, Output> NumOps<Rhs, Output> for T where
    T: Sub<Rhs, Output = Output> + Mul<Rhs, Output = Output> + Div<Rhs, Output = Output> + Add<Rhs, Output = Output> + Rem<Rhs, Output = Output>, 
[src]