pub struct Classifier<T> { /* private fields */ }Expand description
Classifies things into similar sets (Classifier): every class is either a
subset of, or disjoint from, each of the sets added.
Implementations§
Source§impl<T: Ord + Clone> Classifier<T>
impl<T: Ord + Clone> Classifier<T>
Sourcepub fn new(sort: bool) -> Self
pub fn new(sort: bool) -> Self
Classifier(sort=sort): with sort, the classes are sorted by
decreasing size, then by their sorted things.
Sourcepub fn add(&mut self, set_of_things: impl IntoIterator<Item = T>)
pub fn add(&mut self, set_of_things: impl IntoIterator<Item = T>)
Adds a set (add).
The classes split by the set are processed in the order of their smallest thing in it, which is the order of Python’s set iteration for small integers; it only matters to the order of unsorted classes.
Sourcepub fn update<I: IntoIterator<Item = T>>(
&mut self,
list_of_sets: impl IntoIterator<Item = I>,
)
pub fn update<I: IntoIterator<Item = T>>( &mut self, list_of_sets: impl IntoIterator<Item = I>, )
Adds sets (update).
Sourcepub fn get_things(&mut self) -> &BTreeSet<T>
pub fn get_things(&mut self) -> &BTreeSet<T>
All things known so far (getThings).
Sourcepub fn get_classes(&mut self) -> &[BTreeSet<T>]
pub fn get_classes(&mut self) -> &[BTreeSet<T>]
The class sets (getClasses).
Sourcepub fn get_mapping(&mut self) -> &BTreeMap<T, usize>
pub fn get_mapping(&mut self) -> &BTreeMap<T, usize>
The index in Classifier::get_classes of the class of each thing
(getMapping, which maps to the class sets themselves).
Trait Implementations§
Source§impl<T: Clone> Clone for Classifier<T>
impl<T: Clone> Clone for Classifier<T>
Source§impl<T: Debug> Debug for Classifier<T>
impl<T: Debug> Debug for Classifier<T>
Auto Trait Implementations§
impl<T> Forget for Classifier<T>
impl<T> Freeze for Classifier<T>where
*const LeafNode<T, SetValZST> is !null: Freeze,
PhantomData<(Owned, LeafOrInternal)>: Freeze,
PhantomData<Box<(T, SetValZST)>>: Freeze,
*const u8 is !null: Freeze,
PhantomData<BTreeSet<T>>: Freeze,
*const LeafNode<T, usize> is !null: Freeze,
PhantomData<Box<(T, usize)>>: Freeze,
impl<T> Move for Classifier<T>
impl<T> RefUnwindSafe for Classifier<T>where
T: RefUnwindSafe,
impl<T> Send for Classifier<T>
impl<T> Sync for Classifier<T>
impl<T> Unpin for Classifier<T>
impl<T> UnsafeUnpin for Classifier<T>where
*const LeafNode<T, SetValZST> is !null: UnsafeUnpin,
PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin,
PhantomData<Box<(T, SetValZST)>>: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<BTreeSet<T>>: UnsafeUnpin,
*const LeafNode<T, usize> is !null: UnsafeUnpin,
PhantomData<Box<(T, usize)>>: UnsafeUnpin,
impl<T> UnwindSafe for Classifier<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more