throttler 0.1.3

Simple throttler written in Rust
Documentation
  • Coverage
  • 100%
    6 out of 6 items documented4 out of 5 items with examples
  • Size
  • Source code size: 17.05 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.35 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 9s Average build duration of successful builds.
  • all releases: 9s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • gciruelos/rust-throttler
    10 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • gciruelos

rust-throttler

Simple throttler for Rust.

Crate Version Build Status Documentation

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.