pub struct RateDetector { /* private fields */ }Expand description
Fires when at least count matching events occur within window.
On each check():
- If
eventisSomeand the filter accepts it, push the current timestamp. - Expire timestamps older than
window. - Return
trueif the remaining count >= threshold.
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for RateDetector
impl !RefUnwindSafe for RateDetector
impl Send for RateDetector
impl Sync for RateDetector
impl Unpin for RateDetector
impl !UnwindSafe for RateDetector
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