Skip to main content

Lifecycle

Trait Lifecycle 

Source
pub trait Lifecycle: Send + Sync {
    // Provided methods
    fn start(&self) -> Result<(), String> { ... }
    fn stop(&self) { ... }
}
Expand description

A service with a start and a stop: a connection pool to warm, a background thread to join (18.35.0). Register it with Container::register_managed; both default to doing nothing.

Provided Methods§

Source

fn start(&self) -> Result<(), String>

Called by Container::start, in registration order.

Source

fn stop(&self)

Called by Container::stop, in reverse order — only if start succeeded.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§