pub struct ShutdownCoordinator { /* private fields */ }Expand description
Ordered shutdown phase coordinator.
The coordinator owns phase ordering, timeout handling, duration collection,
and error aggregation. Product crates provide the actual phase closures.
Phases are FnMut so shutdown code can move owned handles into the
coordinator and consume them exactly once during the shutdown run.
Implementations§
Source§impl ShutdownCoordinator
impl ShutdownCoordinator
Sourcepub fn phase<F, Fut>(
&mut self,
name: &'static str,
timeout: Option<Duration>,
phase: F,
) -> &mut Self
pub fn phase<F, Fut>( &mut self, name: &'static str, timeout: Option<Duration>, phase: F, ) -> &mut Self
Registers a shutdown phase.
Sourcepub async fn run(&mut self) -> ShutdownReport
pub async fn run(&mut self) -> ShutdownReport
Runs phases sequentially and returns a report.
Later phases still run when an earlier phase fails. This lets product shutdown code make best-effort progress through independent resources.
Trait Implementations§
Source§impl Default for ShutdownCoordinator
impl Default for ShutdownCoordinator
Source§fn default() -> ShutdownCoordinator
fn default() -> ShutdownCoordinator
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ShutdownCoordinator
impl !RefUnwindSafe for ShutdownCoordinator
impl Send for ShutdownCoordinator
impl !Sync for ShutdownCoordinator
impl Unpin for ShutdownCoordinator
impl UnsafeUnpin for ShutdownCoordinator
impl !UnwindSafe for ShutdownCoordinator
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more