[][src]Type Definition tallystick::borda::DefaultBordaTally

type DefaultBordaTally<T> = BordaTally<T, u64>;

A borda tally using u64 integers to count votes. DefaultBordaTally is generally preferred over BordaTally, except when using the Variant::Dowdall variant. Since this is an alias, refer to BordaTally for method documentation.

Example

   use tallystick::borda::DefaultBordaTally;
   use tallystick::borda::Variant;

   // 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 = DefaultBordaTally::<u32>::new(1, Variant::Borda);
   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);