pub struct Forests<T>{ /* private fields */ }Expand description
Data structure for building disjoint sets
Implementations§
Source§impl<T> Forests<T>
impl<T> Forests<T>
pub fn new() -> Self
Sourcepub fn count_sets(&mut self) -> usize
pub fn count_sets(&mut self) -> usize
Counts the number of unique disjoint sets.
Sourcepub fn group_items(&mut self, items: &[T]) -> Vec<Vec<usize>>
pub fn group_items(&mut self, items: &[T]) -> Vec<Vec<usize>>
Groups items by their containing sets. The result is the indices of items in the provided items
that belongs to different disjoint sets. The order of groups is arbitrary.
Items that do not exist in the forest belongs to the same group that does not consist of other contained items.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Forests<T>
impl<T> RefUnwindSafe for Forests<T>where
T: RefUnwindSafe,
impl<T> Send for Forests<T>where
T: Send,
impl<T> Sync for Forests<T>where
T: Sync,
impl<T> Unpin for Forests<T>where
T: Unpin,
impl<T> UnwindSafe for Forests<T>where
T: UnwindSafe,
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more