RateCounter
pub struct RateCounter { /* private fields */ }A rate counter that can be used with a edge rate limiter or stand alone for counting and rate calculations
Methods
increment
View sourceIncrement an entry in the ratecounter by delta.
Parameters
- self: &Self
- entry: &str
- delta: u32
Returns
lookup_count
View sourceLookup the current count for entry in the ratecounter for duration.
Parameters
- self: &Self
- entry: &str
- duration: CounterDuration
Returns
lookup_rate
View sourceLookup the current rate for entry in the ratecounter for a window.
Parameters
- self: &Self
- entry: &str
- window: RateWindow
Returns
open
View sourcefn open(ratecounter_name: &str) -> SelfOpen a RateCounter with the given name for a ratecounter.
Parameters
- ratecounter_name: &str
Returns
Self