Skip to main content

ComponentLifecycle

Trait ComponentLifecycle 

Source
pub trait ComponentLifecycle: Send + Sync {
    // Required methods
    fn name(&self) -> &'static str;
    fn start(
        &self,
    ) -> Pin<Box<dyn Future<Output = Result<(), SaddleError>> + Send + '_>>;
    fn shutdown(
        &self,
    ) -> Pin<Box<dyn Future<Output = Result<(), SaddleError>> + Send + '_>>;
}
Expand description

Object-safe lifecycle contract used by the Saddle application assembler.

Implementations must be safe to start once and shut down once. Ordering and graceful-drain policy belong to saddle-runtime, not this contract.

Required Methods§

Source

fn name(&self) -> &'static str

Source

fn start( &self, ) -> Pin<Box<dyn Future<Output = Result<(), SaddleError>> + Send + '_>>

Source

fn shutdown( &self, ) -> Pin<Box<dyn Future<Output = Result<(), SaddleError>> + Send + '_>>

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§