hot-ranking-algorithm-rust 1.0.1

Algorithm that measures how relevant a given data set is, kinda like Reddit
docs.rs failed to build hot-ranking-algorithm-rust-1.0.1
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.

hot-ranking-algorithm-rs

Algorithm that measures how relevant a given data set is, kinda like Reddit.

Doesn't do any jitter stuff and can probably be gamed if you try hard enough, but it should be useful enough if you want to wire up community-driven news site that always has fresh, relevant content for people to discover.

Usage

extern crate hot_ranking_algorithm;
extern crate time;

use hot-ranking-algorithm::rank;

let epoch = time::now_utc();
let timestamp = time::now_utc();
let upvotes = 3;
let downvotes = 1;
let ranking = rank(upvotes, downvotes, timestamp, epoch);
println!('{}', ranking);
// => 2

API

rank(upvotes: &i32, downvotes: &i32, timestamp: &SteadyTime, epoch: &SteadyTime) -> result: i32

Calculate the relevancy of an item based on upvotes, downvotes, a current timestamp and the epoch at which the program is first run (e.g. no value can be lower than that).

Installation

$ cargo add hot-ranking-algorithm

See Also

License

MIT