[][src]Struct wybr::methods::irv::Irv

pub struct Irv<'a> { /* fields omitted */ }

A builder for the setup of an instant-runoff count

See the module level documentation for more.

Default configuration can be generated with Irv::new(&tally), where tally is a VoteTree object. Count is triggered by the run() method, which returns a solitary winner, or an error.

Methods

impl<'a> Irv<'a>[src]

pub fn new(tally: &'a VoteTree) -> Self[src]

Acquire reference to a vote tally and initiate default configuration, which can be altered with other builder methods. The default configuration involved using withdraw list pulled from the tally and seed equal to 21.

pub fn withdraw<I>(&mut self, withdraw: I) -> &mut Self where
    I: IntoIterator<Item = u32>, 
[src]

Alter a list of withdrawn candidates, which are not considered in count.

pub fn seed(&mut self, seed: u32) -> &mut Self[src]

Alters the random seed potentially used by the election algorithm to break ties.

pub fn run(&self) -> Result<GenericOutcome<'a>, ElectionError>[src]

Performs Instant-runoff STV election

Errors

  • NotEnoughCandidates, in case there is less candidates then seats or no votes

Auto Trait Implementations

impl<'a> Send for Irv<'a>

impl<'a> Sync for Irv<'a>

Blanket Implementations

impl<T> From for T[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.