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.
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 !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> FutureExt for T
impl<T> FutureExt for T
Source§fn timeout(self, timeout: Duration) -> Timeout<Self>where
Self: Sized,
fn timeout(self, timeout: Duration) -> Timeout<Self>where
Self: Sized,
tokio::time::timeout, with the advantage that it is easier to write
fluent call chains. Read moreSource§fn timeout_at(self, deadline: Instant) -> Timeout<Self>where
Self: Sized,
fn timeout_at(self, deadline: Instant) -> Timeout<Self>where
Self: Sized,
tokio::time::timeout_at, with the advantage that it is easier to write
fluent call chains. Read moreSource§fn with_cancellation_token(
self,
cancellation_token: &CancellationToken,
) -> WithCancellationTokenFuture<'_, Self>where
Self: Sized,
fn with_cancellation_token(
self,
cancellation_token: &CancellationToken,
) -> WithCancellationTokenFuture<'_, Self>where
Self: Sized,
CancellationToken::run_until_cancelled,
but with the advantage that it is easier to write fluent call chains. Read moreSource§fn with_cancellation_token_owned(
self,
cancellation_token: CancellationToken,
) -> WithCancellationTokenFutureOwned<Self>where
Self: Sized,
fn with_cancellation_token_owned(
self,
cancellation_token: CancellationToken,
) -> WithCancellationTokenFutureOwned<Self>where
Self: Sized,
CancellationToken::run_until_cancelled_owned,
but with the advantage that it is easier to write fluent call chains. Read moreSource§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<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