Expand description
TallyMan is a work-in-progress rust library for tallying votes.
Compatibility
The tallyman
crate currently needs nightly rust. It will move to stable when trait specialization is stabilized.
Modules
Approval voting is a single-winner electoral system where each voter may select (“approve”) any number of
candidates. The winner is the most-approved candidate.
The Borda count is a family of election methods in which voters rank candidates in order of preference.
The Borda count determines the winner by giving each candidate, for each ballot, a number of points corresponding to the number of candidates ranked lower.
Once all votes have been counted the candidate with the most points is the winner.
The Condorcet method is a ranked-choice voting system that elects the candidate that would win a majority
of the vote in all of the head-to-head elections against each of the other candidates.
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.
Score voting or “range voting” is an electoral system in which voters give each candidate a score,
the scores are summed, and the candidate with the highest total is elected. It has been described
by various other names including “evaluative voting”, “utilitarian voting”, and “the point system”.
The single transferable vote (STV) is a ranked choice voting system.
Under STV, a voter has a single vote that is initially allocated to their most preferred candidate. Votes are totalled and a quota
(the number of votes required to win) derived. If a candidate achieves quota, the candidate is elected and any surplus vote
is transferred to other candidates in proportion to the voters’ stated preferences. If no candidate achieves quota,
the bottom candidate is eliminated with votes being transferred to other candidates as determined by the voters’ stated preferences.
These elections, eliminations, and vote transfers continue in rounds until the correct number of candidates are elected.
Structs
RankedWinners
is a ranked list of winning candidates, sorted according to rank.
Ranks are in ascending order. A 0
ranked winner is more significant than a 3
ranked winner.
Winners with the same rank are tied.Enums
A quota defines how many votes are required to win an election in relation to the total number of votes cast.
Traits
A trait for numeric types used to count votes.
This type should be automatically implemented for all numeric types you wish to use.
It is used to provide trait specialization so differnetial logic can applied to
integer or fractional (float) based vote counting.