Skip to main content

TickClosure

Trait TickClosure 

Source
pub trait TickClosure {
    type Metrics: MetricsState;
}
Expand description

Trait for tick closures — abstracts over both concrete async closures (wrapped in [TickClosureFn]) and type-erased boxed versions ([TickClosureErased]).

The &mut Context parameter is owned by Dfir and lent to the closure each tick, avoiding shared-ownership overhead for the context.

The Self::Metrics associated type carries the MetricsState typestate of the context the closure expects, so that Dfir<Tick> can be parameterized by the closure alone.

Required Associated Types§

Source

type Metrics: MetricsState

Whether the context passed to this closure tracks metrics. See MetricsState.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§