pub struct RateLim<T> {
inner: Mutex<Inner<T>>,
}
Expand description
A rate-limited wrapper around a [Loggable
]` that ensures its events are
flushed from time to time.
Fields§
§inner: Mutex<Inner<T>>
The Loggable itself.
Implementations§
Source§impl<T: Loggable> RateLim<T>
impl<T: Loggable> RateLim<T>
Sourcepub fn nonevent<F>(&self, f: F)
pub fn nonevent<F>(&self, f: F)
Adjust the status of this reporter’s Loggable
by calling f
on it,
but only if it is already scheduled to report itself. Otherwise, do nothing.
This is the appropriate function to use for tracking successes.f
Sourcepub fn event<F>(self: &Arc<Self>, rt: &'static dyn RuntimeSupport, f: F)
pub fn event<F>(self: &Arc<Self>, rt: &'static dyn RuntimeSupport, f: F)
Add an event to this rate-limited reporter by calling f
on it, and
schedule it to be reported after an appropriate time.
NOTE: This API is a big ugly. If we ever decide to make it non-hidden, we may want to make it call rt_support() directly again, as it did in earlier visions.
Auto Trait Implementations§
impl<T> !Freeze for RateLim<T>
impl<T> RefUnwindSafe for RateLim<T>
impl<T> Send for RateLim<T>where
T: Send,
impl<T> Sync for RateLim<T>where
T: Send,
impl<T> Unpin for RateLim<T>where
T: Unpin,
impl<T> UnwindSafe for RateLim<T>
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