Expand description
Tallystick is a rust library for tallying votes.
§Compatibility
Tallystick works with both nightly and stable rust, but more functionality is enabled on nightly. Tally methods that must be run with nightly rust are tagged nightly
.
To enable nightly support, add features=["nightly"]
to your Cargo.toml
entry for tallystick
.
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.
nightly
- 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.
- WORK IN PROGRESS
- 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.
- The Schulze method is an voting system that selects a single winner using votes that express preferences.
nightly
- 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.
nightly
- Utilities for parsing common vote formats
Structs§
- A RankedCandidate is candidate in an election, ranked ascending (starting from zero). A ranked-candidate with a lower rank beats a ranked-candidate with a higher rank. Ranked-candidates with the same rank are tied.
RankedWinners
is a ranked list of winning candidates, sorted according to rank. Ranks are in ascending order. A0
ranked winner is more significant than a3
ranked winner. Winners with the same rank are tied.
Enums§
- Requires the
nightly
feature to be enabled A quota defines how many votes are required to win an election in relation to the total number of votes cast.nightly
- TallyError enum contains a list of all errors that may occur during a tally.
- Vote transferring type
Traits§
- A trait for numeric types used to count votes.