pub trait ExecutionMonitor: Send + Sync {
// Provided methods
fn pre_execute(&self, _task: TaskId, _at: Instant) { ... }
fn post_execute(
&self,
_task: TaskId,
_at: Instant,
_took: Duration,
_ok: bool,
) { ... }
}Expand description
Hook invoked before and after every execute call. Defaults are no-ops.
§Why two hooks?
This is the per-execute timing hook: it fires on the dispatch hot
path around every single item invocation, so implementations must stay
cheap. For coarse lifecycle events (executor up/down, app start/stop,
faults, user events) — which fire rarely and can afford more work —
use crate::Observer instead.
Provided Methods§
Sourcefn pre_execute(&self, _task: TaskId, _at: Instant)
fn pre_execute(&self, _task: TaskId, _at: Instant)
Called immediately before an item’s execute() is invoked.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".