pub struct OnlyEvery { /* private fields */ }
Expand description
A simple rate limiter which allows one element through on a given interval.
To use, call check
and do whatever you want to do when it returns true.
The interval can be changed, and this will do what you expect as long as
usage is only single-threaded. In multi-threaded programs, it is guaranteed
that no execution can happen faster than the fastest interval passed to
check
, with behavior returning to normal once all threads are again
passing the same value.
Implementations§
Auto Trait Implementations§
impl !Freeze for OnlyEvery
impl RefUnwindSafe for OnlyEvery
impl Send for OnlyEvery
impl Sync for OnlyEvery
impl Unpin for OnlyEvery
impl UnwindSafe for OnlyEvery
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