Crate throttler [] [src]

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

Modules

simple

This module contains the SimpleThrottler struct, that allows easy-to-use throttling.