Skip to main content

PopulationObserver

Trait PopulationObserver 

Source
pub trait PopulationObserver: Send + 'static {
    // Required method
    fn on_population(&mut self, snapshot: PopulationSnapshot);
}
Expand description

Callback the harness invokes once per generation, after Strategy::tell has returned and the canonical tracing::info! aggregate event has been emitted.

Send + 'static so observers can sit behind Arc<Mutex<dyn PopulationObserver>> and be shared across rayon worker threads — same shape as the RecordSink trait in rlevo-benchmarks.

Required Methods§

Source

fn on_population(&mut self, snapshot: PopulationSnapshot)

Receives one PopulationSnapshot per completed generation.

Implementors should be cheap here: buffer the snapshot and do any heavy I/O (serialization, channel sends) outside this call so the harness loop is not blocked.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§