4 releases
Uses old Rust 2015
0.1.3 | Nov 28, 2016 |
---|---|
0.1.2 | Nov 28, 2016 |
0.1.1 | Nov 28, 2016 |
0.1.0 | Nov 28, 2016 |
#18 in #10
6KB
rust-throttler
Simple throttler for Rust.
It has just a really simple and easy to use throttler struct right now, but fancier ones will be added in the future.
Examples
The following example creates a throttler that allows 4 operations every second, and uses it to print the time 10 times.
use throttler::simple::SimpleThrottler;
use std::time::{Duration, Instant};
let mut t = SimpleThrottler::new(4, Duration::new(1, 0));
for i in 0..10 {
t.wait();
println!("{} {:?}", i, Instant::now());
}
Contributions
Feel free to contribute whatever you want.
lib.rs
:
A simple throttler library.
Examples
The following example creates a throttler that allows 4 operations every second, and uses it to print the time 10 times.
use throttler::simple::SimpleThrottler;
use std::time::{Duration, Instant};
let mut t = SimpleThrottler::new(4, Duration::new(1, 0));
for i in 0..10 {
t.wait();
println!("{} {:?}", i, Instant::now());
}