Skip to main content

ServiceLifecycleObserver

Trait ServiceLifecycleObserver 

Source
pub trait ServiceLifecycleObserver:
    Debug
    + Send
    + Sync {
    // Required method
    fn on_transition(&self, transition: ServiceLifecycleTransition);
}
Expand description

Observes committed state changes without owning the lifecycle.

Callbacks run synchronously outside lifecycle locks. They must be short, nonblocking and panic-free, and must not flush exporters or perform I/O. Concurrent callers may deliver callbacks out of order; each event carries the actual atomic transition and is delivered once, without polling.

Required Methods§

Source

fn on_transition(&self, transition: ServiceLifecycleTransition)

Records a committed transition without waiting for external work.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§