pub struct Splitter { /* private fields */ }
Expand description
Memorizes random assignment of indices to groups.
Implementations§
Source§impl Splitter
impl Splitter
Sourcepub fn new<R: Rng + ?Sized>(
rng: &mut R,
source_len: usize,
group_count: usize,
) -> Self
pub fn new<R: Rng + ?Sized>( rng: &mut R, source_len: usize, group_count: usize, ) -> Self
Randomly assign indices to fixed number of groups.
Create a Splitter
struct, by randomly assigning indices (from
0..source_len
) to a fixed number of groups (group_count
).
The returned struct provides access to the created groups (containing
their assigned indices, see groups
) and allows merging of iterators
(see merge
).
If group_count
is smaller than source_len
, the number of groups is
set (i.e. limited) to input_len
.
Sourcepub fn assignments(&self) -> &[usize]
pub fn assignments(&self) -> &[usize]
Return slice containing index of assigned group for each original index.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Splitter
impl RefUnwindSafe for Splitter
impl Send for Splitter
impl Sync for Splitter
impl Unpin for Splitter
impl UnwindSafe for Splitter
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