pub struct People { /* private fields */ }Expand description
Implementations§
Source§impl People
impl People
Sourcepub fn from_csv<R: Read>(input: R) -> Result<Self, BuddyError>
pub fn from_csv<R: Read>(input: R) -> Result<Self, BuddyError>
Reads people from a CSV file and creates a People struct from that.
The expected format is rows of people like id,name.
Example CSV:
1,John
2,DavidIf the given input doesn’t contain an even number of people, we will add our own with id
usize::MAX, so that id is reserved.
Having that extra user to make it even will keep the algorithm working, so that someone
will be “paired up” with our evenizer, which really means that person won’t get paired.
The beautiful thing is that the algorithm will try and not repeat pairs, which now includes
the evenizer, so the same person will not end up getting not paired all the time.
pub fn len(&self) -> usize
Sourcepub fn has_evenizer(&self) -> bool
pub fn has_evenizer(&self) -> bool
Whether this People set has our evenizer user to make the count even.
pub fn is_empty(&self) -> bool
Trait Implementations§
Auto Trait Implementations§
impl Freeze for People
impl RefUnwindSafe for People
impl Send for People
impl Sync for People
impl Unpin for People
impl UnwindSafe for People
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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