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> UnsafeUnpin for RateLim<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for RateLim<T>
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more