pub trait CounterContext<T> {
    // Required method
    fn with_counters<O, F: FnOnce(&T) -> O>(&self, cb: F) -> O;

    // Provided method
    fn increment<F: FnOnce(&T) -> &Counter>(&self, cb: F) { ... }
}
Expand description

A context that stores counters.

CounterContext exposes access to counters for observation and debugging.

Required Methods§

source

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§

source

fn increment<F: FnOnce(&T) -> &Counter>(&self, cb: F)

Increments the counter returned by the callback.

Object Safety§

This trait is not object safe.

Implementors§