pub trait Outcome {
fn meta(&self) -> &Metadata;
fn deterministic(&self) -> bool;
fn elected(&self) -> CandidateIterator<'_> ⓘ;
fn candidate_count(&self) -> usize;
fn withdrawn(&self) -> CandidateIterator<'_> ⓘ;
fn elected_count(&self) -> usize { ... }
fn elected_names(&self) -> NamesIterator<'_> ⓘ { ... }
fn winner(&self) -> Option<u32> { ... }
fn winner_name(&self) -> Option<String> { ... }
fn withdrawn_count(&self) -> usize { ... }
fn withdrawn_names(&self) -> NamesIterator<'_> ⓘ { ... }
}
Expand description
Trait representing generic output from an election method
Required Methods§
sourcefn deterministic(&self) -> bool
fn deterministic(&self) -> bool
Specify whether the election was deterministic
In other words, returns false
whenever PRNG was used to settle the election.
In case of ranked pairs method, there is a chance for false negatives, i.e. elections deemed not deterministic while there were.
In case of Meek and Warren methods, determinisms may also depend on the numerical issues due to an use of fixed point arithmetic.
sourcefn elected(&self) -> CandidateIterator<'_> ⓘ
fn elected(&self) -> CandidateIterator<'_> ⓘ
Return iterator of IDs of elected candidates
fn candidate_count(&self) -> usize
sourcefn withdrawn(&self) -> CandidateIterator<'_> ⓘ
fn withdrawn(&self) -> CandidateIterator<'_> ⓘ
Return iterator of IDs of withdrawn candidates
Provided Methods§
fn elected_count(&self) -> usize
sourcefn elected_names(&self) -> NamesIterator<'_> ⓘ
fn elected_names(&self) -> NamesIterator<'_> ⓘ
Return iterator of elected candidate names
When there is no name for some candidate (or no names at all), placeholder names featuring 1-based indices of candidates will be generated.
sourcefn winner(&self) -> Option<u32>
fn winner(&self) -> Option<u32>
Return a single winner ID, if there is one, that is either the election scheme is single winner one or there is one seat in multi-winner election
fn winner_name(&self) -> Option<String>
fn withdrawn_count(&self) -> usize
sourcefn withdrawn_names(&self) -> NamesIterator<'_> ⓘ
fn withdrawn_names(&self) -> NamesIterator<'_> ⓘ
Return iterator of names of withdrawn candidates