pub struct ShutdownHandle { /* private fields */ }Expand description
A handle for observing shutdown from a ShutdownCoordinator.
The handle is a Future that resolves once shutdown is triggered, and can also be checked synchronously via
is_triggered. Dropping the handle reports completion back to its coordinator, which is how
ShutdownCoordinator::shutdown_and_wait knows when all outstanding work has finished.
Implementations§
Source§impl ShutdownHandle
impl ShutdownHandle
Sourcepub fn noop() -> Self
pub fn noop() -> Self
Creates a shutdown handle that is never triggered.
This can be useful when a callee requires a handle but no shutdown signal is expected or available to provide.
Sourcepub fn paired() -> (ShutdownCoordinator, Self)
pub fn paired() -> (ShutdownCoordinator, Self)
Creates a coordinator/handle pair.
This is equivalent to creating ShutdownCoordinator and calling ShutdownCoordinator::register. The
resulting coordinator can still be used to register further handles if need be.
Sourcepub fn is_triggered(&self) -> bool
pub fn is_triggered(&self) -> bool
Returns true if shutdown has been triggered.
Sourcepub fn view(&self) -> ShutdownView
pub fn view(&self) -> ShutdownView
Returns a read-only view of this handle’s shutdown signal.
Clone the view to observe the signal from other tasks.
Trait Implementations§
Source§impl Drop for ShutdownHandle
impl Drop for ShutdownHandle
Source§impl Future for ShutdownHandle
impl Future for ShutdownHandle
impl<'pin> Unpin for ShutdownHandlewhere
PinnedFieldsOf<__ShutdownHandle<'pin>>: Unpin,
Auto Trait Implementations§
impl !Freeze for ShutdownHandle
impl !RefUnwindSafe for ShutdownHandle
impl Send for ShutdownHandle
impl Sync for ShutdownHandle
impl !UnsafeUnpin for ShutdownHandle
impl !UnwindSafe for ShutdownHandle
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<F> IntoFuture for Fwhere
F: Future,
impl<F> IntoFuture for Fwhere
F: Future,
Source§type IntoFuture = F
type IntoFuture = F
Source§fn into_future(self) -> <F as IntoFuture>::IntoFuture
fn into_future(self) -> <F as IntoFuture>::IntoFuture
Source§impl<F> TaskInstrument for F
impl<F> TaskInstrument for F
Source§fn with_task_instrumentation(self, task_name: String) -> InstrumentedTask<F> ⓘ
fn with_task_instrumentation(self, task_name: String) -> InstrumentedTask<F> ⓘ
Source§impl<T> Track for T
impl<T> Track for T
Source§fn track_resources(self, token: ResourceGroupToken) -> Tracked<Self> ⓘ
fn track_resources(self, token: ResourceGroupToken) -> Tracked<Self> ⓘ
Tracked wrapper. Read more