Function ratelimit_meter::per_second
source · pub fn per_second<T>(capacity: NonZeroU32) -> Twhere
T: Sized + NewImpl,
Expand description
Construct a new Decider that allows capacity
cells per
second.
Examples
Constructing a GCRA decider that lets through 100 cells per second:
use ratelimit_meter::GCRA;
let _gcra = ratelimit_meter::per_second::<GCRA>(NonZeroU32::new(100).unwrap());
and a leaky bucket:
use ratelimit_meter::LeakyBucket;
let _gcra = ratelimit_meter::per_second::<LeakyBucket>(NonZeroU32::new(100).unwrap());