Type Definition tallystick::condorcet::DefaultCondorcetTally [−][src]
type DefaultCondorcetTally<T> = CondorcetTally<T, u64>;
Expand description
A condorcet tally using u64
integers to count votes.
DefaultCondorcetTally
is generally preferred over CondorcetTally
, except when using vote weights that contains fractions.
Since this is an alias, refer to CondorcetTally
for method documentation.
Example
use tallystick::condorcet::DefaultCondorcetTally; // What is your favourite colour? // A vote with hexadecimal colour candidates and a single-winner. let red = 0xff0000; let blue = 0x00ff00; let green = 0x0000ff; let mut tally = DefaultCondorcetTally::with_candidates(1, vec![red, blue, green]); tally.add(&vec![green, blue, red]); tally.add(&vec![red, green, blue]); tally.add(&vec![blue, green, red]); tally.add(&vec![blue, red, green]); tally.add(&vec![blue, red, green]); let winners = tally.winners().into_unranked(); // Blue wins! assert!(winners[0] == 0x00ff00);