Skip to main content

Limiter

Trait Limiter 

Source
pub trait Limiter {
    // Required methods
    fn inc(&self, limit: u32) -> bool;
    fn rate(&self) -> f64;
    fn update_rate(&self) -> f64;
}

Required Methods§

Source

fn inc(&self, limit: u32) -> bool

Takes the limit per interval. Returns false if the limit is exceeded, otherwise true.

Source

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().

Source

fn update_rate(&self) -> f64

Updates the rate and returns it

Implementors§