[][src]Enum wybr::tally::VoteToken

pub enum VoteToken {
    DeclareCandidates(u32),
    DeclareSeats(u32),
    WithdrawCandidate(u32),
    BallotRepeat(u64),
    Vote(i32u32),
    CandidateName(u32String),
    ElectionTitle(String),
    EndBallot,
    EndBallots,
    ReadFailure(VoteReadError),
}

VoteToken represents an unit of information parsed from the input file Wybr I/O is based on an idea that ballot file parser shall return an iterator of VoteTokens, and they can be collected into something that is Tally, currently VoteMatrix or VoteTree. Finally, either of this is then passed to some vote counting method or other tool.

Variants

DeclareCandidates(u32)

Candidate number declaration; must happen before any Vote or Ballot*

DeclareSeats(u32)

Seats (number of candidates to be elected) declaration; ignored by some methods

WithdrawCandidate(u32)

Withdraw certain candidate of a given ID; ignored by some methods

BallotRepeat(u64)

Declare how many times the current ballot was observed; obligatory

Vote(i32u32)

Vote -- priority (the lower the better, i32::MAX is reserved) and candidate ID

CandidateName(u32String)

Declare candidate name; optional

ElectionTitle(String)

Declare election name; optional

EndBallot

Finish current ballot; obligatory

EndBallots

Expect no more ballot in this iterator; obligatory

ReadFailure(VoteReadError)

Read failure

Trait Implementations

impl FromIterator<VoteToken> for Result<VoteMatrix, VoteReadError>[src]

impl FromIterator<VoteToken> for Result<VoteTree, VoteReadError>[src]

Iterator collector for creating VoteTree from a stream of VoteTokens, as returned by ballot file parsers or user-defined sources like DB cursors, etc.

Auto Trait Implementations

impl Send for VoteToken

impl Sync for VoteToken

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.