Trait netstack3_base::CounterContext

source ·
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§

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.

source

fn add<F: FnOnce(&T) -> &Counter>(&self, n: u64, cb: F)

Adds the provided value to the counter returned by the callback.

Object Safety§

This trait is not object safe.

Implementors§