Skip to main content

MonitorSet

Trait MonitorSet 

Source
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 ExecutionMonitor implementors (races via tokio::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§

Source

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.

Implementations on Foreign Types§

Source§

impl<M0: ExecutionMonitor> MonitorSet for (M0,)

Source§

fn to_race(&self) -> Result<Pin<Box<dyn Future<Output = &'static str> + Send>>>

Source§

impl<M0: ExecutionMonitor, M1: ExecutionMonitor> MonitorSet for (M0, M1)

Source§

fn to_race(&self) -> Result<Pin<Box<dyn Future<Output = &'static str> + Send>>>

Source§

impl<M0: ExecutionMonitor, M1: ExecutionMonitor, M2: ExecutionMonitor> MonitorSet for (M0, M1, M2)

Source§

fn to_race(&self) -> Result<Pin<Box<dyn Future<Output = &'static str> + Send>>>

Source§

impl<M0: ExecutionMonitor, M1: ExecutionMonitor, M2: ExecutionMonitor, M3: ExecutionMonitor> MonitorSet for (M0, M1, M2, M3)

Source§

fn to_race(&self) -> Result<Pin<Box<dyn Future<Output = &'static str> + Send>>>

Source§

impl<M0: ExecutionMonitor, M1: ExecutionMonitor, M2: ExecutionMonitor, M3: ExecutionMonitor, M4: ExecutionMonitor> MonitorSet for (M0, M1, M2, M3, M4)

Source§

fn to_race(&self) -> Result<Pin<Box<dyn Future<Output = &'static str> + Send>>>

Implementors§