pub trait CounterContext<T> {
// Required method
fn with_counters<O, F: FnOnce(&T) -> O>(&self, cb: F) -> O;
// Provided methods
fn increment<F: FnOnce(&T) -> &Counter>(&self, cb: F) { ... }
fn add<F: FnOnce(&T) -> &Counter>(&self, n: u64, cb: F) { ... }
}
Expand description
A context that stores counters.
CounterContext
exposes access to counters for observation and debugging.
Required Methods§
Sourcefn with_counters<O, F: FnOnce(&T) -> O>(&self, cb: F) -> O
fn with_counters<O, F: FnOnce(&T) -> O>(&self, cb: F) -> O
Call the function with an immutable reference to counter type T.
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.