vote

Crates.iovote
lib.rsvote
version0.1.3
sourcesrc
created_at2020-08-02 17:04:02.388256
updated_at2020-08-12 19:23:38.215856
descriptionCommon voting methods
homepagehttps://github.com/cmccomb/vote
repositoryhttps://github.com/cmccomb/vote
max_upload_size
id272272
size11,841
Chris McComb (cmccomb)

documentation

https://docs.rs/vote

README

Build Status

About

This crate provides functionality for several common ranked choice voting methods.

Example Usage

Using this crate is easy! Simply add this crate as a dependency and then use it:

use vote::{random_dictator, Preference};

fn main() {
    // Make a preference profile
    let v = Preference(vec![vec![0, 1, 2, 3]; 4]);

    // Make a voting method
    let x = random_dictator(v);

    // Get the result
    println!("{:?}", x.0)
}

The preferences profile is a unit struct which contains something of type vec<vec<T>> which represents. The first level of indexes represents the voters, each of whom has a vec<T> to encode their votes. This vec contains unique items such that if an item is at index i, its rank in the vote is i+1.

Commit count: 13

cargo fmt