Skip to main content

Crate circlejerk

Crate circlejerk 

Source
Expand description

Track opinions and measure how strongly a group agrees.

CircleJerk stores submitted opinions and exposes the most common one, the share of submissions supporting it, and whether every submission is identical.

§Example

use circlejerk::CircleJerk;

let mut group = CircleJerk::new();
group.agree("Rust is great");
group.agree("Rust is great");
group.agree("Other languages are fine too");

assert_eq!(group.participants(), 3);
assert_eq!(group.dominant_opinion(), Some("Rust is great"));
assert_eq!(group.consensus_ratio(), 2.0 / 3.0);
assert!(!group.consensus());

Structs§

CircleJerk
An in-memory collection of submitted opinions.