Struct fastly::erl::RateCounter
source · pub struct RateCounter { /* private fields */ }
Expand description
A rate counter that can be used with a edge rate limiter or stand alone for counting and rate calculations
Implementations§
source§impl RateCounter
impl RateCounter
sourcepub fn open(ratecounter_name: &str) -> Self
pub fn open(ratecounter_name: &str) -> Self
Open a RateCounter with the given name for a ratecounter.
sourcepub fn increment(&self, entry: &str, delta: u32) -> Result<(), ERLError>
pub fn increment(&self, entry: &str, delta: u32) -> Result<(), ERLError>
Increment an entry in the ratecounter by delta.
sourcepub fn lookup_rate(
&self,
entry: &str,
window: RateWindow
) -> Result<u32, ERLError>
pub fn lookup_rate( &self, entry: &str, window: RateWindow ) -> Result<u32, ERLError>
Lookup the current rate for entry in the ratecounter for a window.
sourcepub fn lookup_count(
&self,
entry: &str,
duration: CounterDuration
) -> Result<u32, ERLError>
pub fn lookup_count( &self, entry: &str, duration: CounterDuration ) -> Result<u32, ERLError>
Lookup the current count for entry in the ratecounter for duration.
Auto Trait Implementations§
impl RefUnwindSafe for RateCounter
impl Send for RateCounter
impl Sync for RateCounter
impl Unpin for RateCounter
impl UnwindSafe for RateCounter
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more