pub struct ElectionBuilder {
title: Option<String>,
num_seats: Option<usize>,
num_ballots: Option<usize>,
candidates: Vec<Candidate>,
ballots: Vec<Ballot>,
tie_order: Option<HashMap<usize, usize>>,
}Expand description
Builder for the Election type.
Fields§
§title: Option<String>§num_seats: Option<usize>§num_ballots: Option<usize>§candidates: Vec<Candidate>§ballots: Vec<Ballot>§tie_order: Option<HashMap<usize, usize>>Implementations§
Source§impl ElectionBuilder
impl ElectionBuilder
Sourcepub fn num_ballots(self, num_ballots: usize) -> Self
pub fn num_ballots(self, num_ballots: usize) -> Self
Sets the number of ballots cast in the election.
Sourcepub fn check_num_ballots(self, num_ballots: usize) -> Self
pub fn check_num_ballots(self, num_ballots: usize) -> Self
Checks that the given number of ballots is consistent with the actual
number of ballots previously set with Self::ballots().
Sourcepub fn candidates(self, candidates: impl Into<Vec<Candidate>>) -> Self
pub fn candidates(self, candidates: impl Into<Vec<Candidate>>) -> Self
Sets the list of candidates in the election.
Trait Implementations§
Source§impl Default for ElectionBuilder
impl Default for ElectionBuilder
Source§fn default() -> ElectionBuilder
fn default() -> ElectionBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ElectionBuilder
impl RefUnwindSafe for ElectionBuilder
impl Send for ElectionBuilder
impl Sync for ElectionBuilder
impl Unpin for ElectionBuilder
impl UnwindSafe for ElectionBuilder
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