Skip to main content

EngineSession

Trait EngineSession 

Source
pub trait EngineSession: Send {
    // Required methods
    fn run_batch(
        &mut self,
        batch: &StepBatch,
        world: &mut World,
        events: &EventSink,
        cancel: &CancellationToken,
    ) -> BatchResult;
    fn finish(&mut self) -> Result<(), EngineError>;

    // Provided method
    fn batch_budget(&mut self, _batch: &StepBatch) -> Option<Duration> { ... }
}
Expand description

A live per-scenario engine session (ADR-0002). Only a session runs batches — lifecycle is enforced by this ownership shape, not typestate.

Required Methods§

Source

fn run_batch( &mut self, batch: &StepBatch, world: &mut World, events: &EventSink, cancel: &CancellationToken, ) -> BatchResult

Execute one batch of contiguous same-engine steps, threading captures through world and emitting progress on events. Engines may honor cancel at finer grain than batch boundaries when they can (ADR-0007).

Source

fn finish(&mut self) -> Result<(), EngineError>

Tear the session down (reverse open order; Drop is the backstop).

Provided Methods§

Source

fn batch_budget(&mut self, _batch: &StepBatch) -> Option<Duration>

The wall-clock budget for the next dispatch of batch (ADR-0007: Σ(entry timeout × (retries + 1)) + intervals + margin). None when the engine cannot estimate — the orchestrator falls back to its default. The watchdog abandons the scenario thread when the budget expires.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§