circlejerk 0.1.1

A tiny in-memory opinion tracker for measuring group consensus
Documentation
  • Coverage
  • 100%
    8 out of 8 items documented1 out of 8 items with examples
  • Size
  • Source code size: 7.28 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 177.08 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 1s Average build duration of successful builds.
  • all releases: 4s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • amityagov

circlejerk

A tiny in-memory opinion tracker for measuring group consensus.

circlejerk counts repeated opinions and reports whether a group agrees, how strong the dominant opinion is, and which opinion has the most support.

Usage

Add the crate to your project:

[dependencies]
circlejerk = "0.1.1"

Record opinions and inspect the result:

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());

Each call to agree counts as one participant. The crate does not track participant identities. If several opinions tie for the most support, dominant_opinion may return any one of them.

License

Licensed under the MIT License. See LICENSE for details.