pub trait Limiter {
// Required methods
fn inc(&self, limit: u32) -> bool;
fn rate(&self) -> f64;
fn update_rate(&self) -> f64;
}Required Methods§
Sourcefn inc(&self, limit: u32) -> bool
fn inc(&self, limit: u32) -> bool
Takes the limit per interval. Returns false if the limit is exceeded, otherwise true.
Sourcefn rate(&self) -> f64
fn rate(&self) -> f64
Returns the effective rate per interval. Note: The rate is only guaranteed to be accurate immediately after a call to inc().
Sourcefn update_rate(&self) -> f64
fn update_rate(&self) -> f64
Updates the rate and returns it