concurrent-round-robin

Crates.ioconcurrent-round-robin
lib.rsconcurrent-round-robin
version0.1.0
sourcesrc
created_at2022-02-15 03:56:29.538826
updated_at2022-02-15 03:56:29.538826
descriptionA concurrent wrr implementation for rust
homepage
repositoryhttps://github.com/blazood/concurrent-round-robin
max_upload_size
id532535
size6,917
(blazood)

documentation

README

concurrent-round-robin

A concurrent wrr implementation for rust

quick start

[dependencies]
concurrent-round-robin="0.1"
use concurrent_round_robin::WeightedRoundRobinSelector;

fn main() {
    let balancer = Arc::new(WeightedRoundRobinSelector::new(
        vec![("1", 1), ("2", 2)]
    ));
    for _i in 0..100 {
        let arc = balancer.clone();
        std::thread::spawn(move || {
            println!("{}", arc.select().unwrap().value());
        });
    }
}
Commit count: 5

cargo fmt