Provides a
Rust
Stream
combinator, to limit the rate at which items are produced.
poll()
,
and not via any sort of buffering.Stream
's and Future
's.Stream
```rust let rate = ThrottleRate::new(5, Duration::new(2, 0)); let pool = ThrottlePool::new(rate);
let work = stream::repeat(()) .throttle(pool) .foreach(|| Ok(()));
tokio::run(work); ```
Future
```rust let rate = ThrottleRate::new(5, Duration::new(2, 0)); let pool = ThrottlePool::new(rate);
pool.queue() .then(|_| Ok(()));
tokio::run(work); ```