Trait wybr::outcome::Outcome

source ·
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§

source

fn meta(&self) -> &Metadata

Reference to the election metadata

source

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.

source

fn elected(&self) -> CandidateIterator<'_>

Return iterator of IDs of elected candidates

source

fn candidate_count(&self) -> usize

source

fn withdrawn(&self) -> CandidateIterator<'_>

Return iterator of IDs of withdrawn candidates

Provided Methods§

source

fn elected_count(&self) -> usize

source

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.

source

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

source

fn winner_name(&self) -> Option<String>

source

fn withdrawn_count(&self) -> usize

source

fn withdrawn_names(&self) -> NamesIterator<'_>

Return iterator of names of withdrawn candidates

Implementors§