pub trait ResourceCounterContext<R, T>: CounterContext<T> {
    // Required method
    fn with_per_resource_counters<O, F: FnOnce(&T) -> O>(
        &mut self,
        resource: &R,
        cb: F
    ) -> O;

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

A context that provides access to per-resource counters for observation and debugging.

Required Methods§

source

fn with_per_resource_counters<O, F: FnOnce(&T) -> O>( &mut self, resource: &R, cb: F ) -> O

Call cb with an immutable reference to the set of counters on resource.

Provided Methods§

source

fn increment<F: Fn(&T) -> &Counter>(&mut self, resource: &R, cb: F)

Increments both the per-resource and stackwide versions of the counter returned by the callback.

Object Safety§

This trait is not object safe.

Implementors§