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 block on a Study::optimize of the same study (for example by joining the thread running it): that loop’s ask is refused with backpressure until delivery returns, and it retries rather than fails, so 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§