use crateResult;
/// A service or resource that can be shut down gracefully.
///
/// Implement this trait for every long-running component that needs cleanup on
/// process exit — HTTP servers, background workers, connection pools, etc.
/// The [`run!`](crate::run) macro calls [`Task::shutdown`] on each registered
/// task in declaration order after a shutdown signal is received.
///
/// # Contract
///
/// - Implementors must be `Send + 'static` so they can be moved across threads.
/// - `shutdown` consumes `self` — the task cannot be used after shutdown.
/// - Return `Err` only for genuinely unexpected failures; normal teardown should
/// return `Ok(())`.