Skip to main content

on_stop

Attribute Macro on_stop 

Source
#[on_stop]
Expand description

Marks a method as a replay stop handler.

This handler is called when the replay ends (CDemoStop message). Use it to finalize results, output statistics, or clean up resources.

§Parameters

The handler can receive:

  • ctx: &Context (optional) - Final replay state

§Examples

§Output final statistics

#[on_stop]
fn on_stop(&mut self, ctx: &Context) -> ObserverResult {
    println!("Replay ended at tick {}", ctx.tick());
    println!("Total ticks processed: {}", self.ticks);
    Ok(())
}

§Without context

#[on_stop]
fn on_stop(&mut self) -> ObserverResult {
    println!("Replay complete");
    Ok(())
}