Skip to main content

StudyObserver

Trait StudyObserver 

pub trait StudyObserver: Send + Sync {
    // Required method
    fn on_event(&self, event: &StudyEvent);
}
Expand description

Receives typed study lifecycle events.

Implementations must return quickly and should not panic. Delivery is synchronous with the operation that emits it. Parallel operations and separate handles may invoke an observer concurrently. A panic unwinds to the operation that emitted the event. The event is already committed and remains committed; observer delivery does not provide rollback. With panic = "abort", a panic aborts the process.

Events can be delivered from inside the study’s finalization, so an observer must not wait on the study’s workers (D151): not on a Study::optimize of the same study (for example by joining the thread running it), whose ask is refused with backpressure until delivery returns and retries rather than fails, and not on a thread using one of the study’s live TrialCtx values, whose suggest and report calls wait until delivery returns. Either way neither ever finishes.

Required Methods§

fn on_event(&self, event: &StudyEvent)

Handles one committed lifecycle event.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§