pub struct VoteTree { /* private fields */ }
Implementations§
source§impl VoteTree
impl VoteTree
pub fn new(candidates: u32) -> VoteTree
pub fn get_candidates(&self) -> u32
pub fn ballot_count(&self) -> u64
pub fn stream_ballots<F: FnMut(u64, &[u32])>(&self, reader: &mut F)
pub fn assign_votes(&self, eliminated: &HashSet<u32>) -> (u64, HashMap<u32, u64>)
pub fn transfer_votes_fp(
&self,
weights: &HashMap<u32, u64>,
base: u64,
transfer: Transfer
) -> (u64, HashMap<u32, u64>)
pub fn count_ranks(&self, skipped: &HashSet<u32>) -> HashMap<(u32, u32), u64>
Trait Implementations§
source§impl<'a> FromIterator<&'a (u64, Vec<u32, Global>)> for VoteTree
impl<'a> FromIterator<&'a (u64, Vec<u32, Global>)> for VoteTree
Iterator collector for fast&dirty creation of VoteTrees in tests and examples
source§impl Tally for VoteTree
impl Tally for VoteTree
source§fn get_candidates(&self) -> u32
fn get_candidates(&self) -> u32
Returns the number of candidates
source§fn name_candidate(&self, id: u32) -> Option<&String>
fn name_candidate(&self, id: u32) -> Option<&String>
Get the name of a candidate from metadata
source§fn map_withdrawn<F: FnMut(u32)>(&self, f: F)
fn map_withdrawn<F: FnMut(u32)>(&self, f: F)
Map over IDs of withdrawn candidates