Expand description
A metric counting how many times an expression as been hit, before it returns.
This is a light-weight metric.
By default, HitCount
uses a lock-free u64
Counter
, which makes sense
in multithread scenarios. Non-threaded applications can gain performance by
using a std::cell:Cell<u64>
instead.
Tuple Fields
0: C
Trait Implementations
sourceimpl<C: Counter, R> OnResult<R> for HitCount<C>
impl<C: Counter, R> OnResult<R> for HitCount<C>
sourcefn on_result(&self, enter: Self::E, _result: &R) -> Advice
fn on_result(&self, enter: Self::E, _result: &R) -> Advice
Called when an expression has returned. Read more
sourcefn leave_scope(&self, _enter: Self::E) -> Advice
fn leave_scope(&self, _enter: Self::E) -> Advice
Called when an expression has exited, but the return value isn’t known.
This can happen because of a panic, or if control flow bypasses a macro.
This is also called by the default implementation of on_result
. Read more
impl<C: Counter, R> Metric<R> for HitCount<C>
Auto Trait Implementations
impl<C> RefUnwindSafe for HitCount<C> where
C: RefUnwindSafe,
impl<C> Send for HitCount<C> where
C: Send,
impl<C> Sync for HitCount<C> where
C: Sync,
impl<C> Unpin for HitCount<C> where
C: Unpin,
impl<C> UnwindSafe for HitCount<C> where
C: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more