pub struct Election {
pub title: String,
pub num_candidates: usize,
pub num_seats: usize,
pub num_ballots: usize,
pub candidates: Vec<Candidate>,
pub ballots: Vec<Ballot>,
pub tie_order: HashMap<usize, usize>,
}Expand description
Election input, representing a parsed ballot file.
Fields§
§title: StringName of the election.
num_candidates: usizeNumber of candidates.
num_seats: usizeNumber of elected seats.
num_ballots: usizeNumber of ballots that were cast in the election.
candidates: Vec<Candidate>Candidates in this election.
ballots: Vec<Ballot>Ballots that were cast in this election.
tie_order: HashMap<usize, usize>Tie-break order of candidates, mapping each candidate ID to its order in the tie break.
Implementations§
Source§impl Election
impl Election
Sourcepub fn builder() -> ElectionBuilder
pub fn builder() -> ElectionBuilder
Returns a new builder.
Sourcepub fn has_any_tied_ballot(&self) -> bool
pub fn has_any_tied_ballot(&self) -> bool
Returns true if any ballot contains candidates ranked equally.
pub(crate) fn debug_allocations(&self)
Trait Implementations§
impl Eq for Election
impl StructuralPartialEq for Election
Auto Trait Implementations§
impl Freeze for Election
impl RefUnwindSafe for Election
impl Send for Election
impl Sync for Election
impl Unpin for Election
impl UnwindSafe for Election
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