Module tallystick::plurality [−][src]
Expand description
Plurality voting is an electoral system in which each voter is allowed to vote for only one candidate and the candidate who polls the most among their counterparts (a plurality) is elected. It may be called first-past-the-post (FPTP), single-choice voting, simple plurality, or relative/simple majority.
Example
use tallystick::plurality::DefaultPluralityTally; // Election between Alice, Bob, and Cir with two winners. let mut tally = DefaultPluralityTally::new(2); tally.add("Alice"); tally.add("Cir"); tally.add("Bob"); tally.add("Alice"); tally.add("Alice"); tally.add("Bob"); let winners = tally.winners().into_unranked(); println!("The winners are {:?}", winners);
Structs
A generic plurality tally.
Type Definitions
A plurality tally using u64
integers to count votes.
DefaultPluralityTally
is generally preferred over PluralityTally
.
Since this is an alias, refer to PluralityTally
for method documentation.