Subsets

Trait Subsets 

Source
pub trait Subsets<T>: Default {
    // Required methods
    fn set_limit(&mut self, m: &T);
    fn inc_limit(&mut self);
    fn clear(&mut self);
    fn done(&mut self, n: usize);
    fn reset(&mut self, n: usize);
    fn add(&mut self, idx: usize, v: &T);
    fn remove(&mut self, idx: usize, v: &T);
}
Expand description

Trait used by SetPartition structs to notify the subsets structure of changes.

A no-op implementation is available for ().

The VecSubsets, HashSubsets, BTreeSubsets structs implement this trait to provide an updated view of the subsets in the partition, represented with Vec, HashSet or BTreeSet types respectively.

Required Methods§

Source

fn set_limit(&mut self, m: &T)

Set the number of non-empty sets to m converted to usize

Source

fn inc_limit(&mut self)

Increment the number of non-empty sets

Source

fn clear(&mut self)

Clear all sets, reset the number of non-empty sets to 0

Source

fn done(&mut self, n: usize)

Truncate the number of sets to at most n

Source

fn reset(&mut self, n: usize)

Reset to the trivial partition of size n

Source

fn add(&mut self, idx: usize, v: &T)

Notify addition of idx to the set identified by v

Items must be added to a set in their correct order.

Source

fn remove(&mut self, idx: usize, v: &T)

Notify removal of idx from the set identified by v

This must be the last index added to that set.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<T> Subsets<T> for ()

Source§

fn set_limit(&mut self, _: &T)

Source§

fn inc_limit(&mut self)

Source§

fn clear(&mut self)

Source§

fn done(&mut self, _: usize)

Source§

fn reset(&mut self, _: usize)

Source§

fn add(&mut self, _: usize, _: &T)

Source§

fn remove(&mut self, _: usize, _: &T)

Implementors§

Source§

impl<T> Subsets<T> for BTreeSubsets<T>
where <T as TryInto<usize>>::Error: Debug, <T as TryFrom<usize>>::Error: Debug, T: Clone + TryInto<usize> + TryFrom<usize> + Ord,

Source§

impl<T> Subsets<T> for HashSubsets<T>
where <T as TryInto<usize>>::Error: Debug, <T as TryFrom<usize>>::Error: Debug, T: Clone + TryInto<usize> + TryFrom<usize> + Hash + Eq,

Source§

impl<T> Subsets<T> for VecSubsets<T>
where <T as TryInto<usize>>::Error: Debug, <T as TryFrom<usize>>::Error: Debug, T: Clone + TryInto<usize> + TryFrom<usize>,

Source§

impl<T, const N: usize> Subsets<T> for ArrayVecSubsets<T, N>
where <T as TryInto<usize>>::Error: Debug, <T as TryFrom<usize>>::Error: Debug, T: Clone + TryInto<usize> + TryFrom<usize>,