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 + '_>>;
// Provided method
fn shutdown_with_primary(
&self,
_primary: Option<DiagnosticOccurrence>,
) -> 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§
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 + '_>>
Provided Methods§
Sourcefn shutdown_with_primary(
&self,
_primary: Option<DiagnosticOccurrence>,
) -> Pin<Box<dyn Future<Output = Result<(), SaddleError>> + Send + '_>>
fn shutdown_with_primary( &self, _primary: Option<DiagnosticOccurrence>, ) -> Pin<Box<dyn Future<Output = Result<(), SaddleError>> + Send + '_>>
The cleanup owner may correlate its original source with an existing primary before recording. Components without their own source writer retain the ordinary shutdown behavior.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".