pub trait MonitorSet:
Sealed
+ Send
+ Sync {
// Required method
fn to_race(
&self,
) -> Result<Pin<Box<dyn Future<Output = &'static str> + Send>>>;
}Expand description
A composable set of monitors that produces a single racing future.
This trait is sealed — you cannot implement it directly. It is automatically derived for:
- Any type that implements
ExecutionMonitor(wraps the single future) - Tuples of up to 5
ExecutionMonitorimplementors (races viatokio::select!)
The orchestration layer (handle_event_with_monitor) bounds on
M: MonitorSet and calls to_race() to get
a single future that completes when the first monitor fires.
Required Methods§
Sourcefn to_race(&self) -> Result<Pin<Box<dyn Future<Output = &'static str> + Send>>>
fn to_race(&self) -> Result<Pin<Box<dyn Future<Output = &'static str> + Send>>>
Produce a single future that races all monitors in this set.
Each sub-monitor’s get_monitor() is called on the calling thread
so monitors can capture thread-local state (e.g., CPU clock handles).
The returned future completes when the first monitor fires, returning
the winning monitor’s name for metrics, logging, and stats.