use std::{future::Future, pin::Pin};
use crate::Result;
pub type LifecycleFuture<'a> = Pin<Box<dyn Future<Output = Result<()>> + Send + 'a>>;
/// 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.
pub trait ComponentLifecycle: Send + Sync {
fn name(&self) -> &'static str;
fn start(&self) -> LifecycleFuture<'_>;
fn shutdown(&self) -> LifecycleFuture<'_>;
}