pub struct ShutdownSignal<T: Clone> { /* private fields */ }
Expand description
A future to wait for a shutdown signal.
The future completes when the associated ShutdownManager
triggers a shutdown.
The shutdown signal can be cloned and sent between threads freely.
Implementations§
Source§impl<T: Clone> ShutdownSignal<T>
impl<T: Clone> ShutdownSignal<T>
Sourcepub fn wrap_cancel<F: Future>(&self, future: F) -> WrapCancel<T, F> ⓘ
pub fn wrap_cancel<F: Future>(&self, future: F) -> WrapCancel<T, F> ⓘ
Wrap a future so that it is cancelled when a shutdown is triggered.
The returned future completes with Err(reason)
containing the shutdown reason if a shutdown is triggered,
and with Ok(x)
when the wrapped future completes.
The wrapped future is dropped if the shutdown starts before the wrapped future completes.
Trait Implementations§
Source§impl<T: Clone> Clone for ShutdownSignal<T>
impl<T: Clone> Clone for ShutdownSignal<T>
Source§impl<T: Clone> Drop for ShutdownSignal<T>
impl<T: Clone> Drop for ShutdownSignal<T>
Source§impl<T: Clone> Future for ShutdownSignal<T>
impl<T: Clone> Future for ShutdownSignal<T>
Auto Trait Implementations§
impl<T> Freeze for ShutdownSignal<T>
impl<T> RefUnwindSafe for ShutdownSignal<T>
impl<T> Send for ShutdownSignal<T>where
T: Send,
impl<T> Sync for ShutdownSignal<T>where
T: Send,
impl<T> Unpin for ShutdownSignal<T>
impl<T> UnwindSafe for ShutdownSignal<T>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<F> IntoFuture for Fwhere
F: Future,
impl<F> IntoFuture for Fwhere
F: Future,
Source§type IntoFuture = F
type IntoFuture = F
Which kind of future are we turning this into?
Source§fn into_future(self) -> <F as IntoFuture>::IntoFuture
fn into_future(self) -> <F as IntoFuture>::IntoFuture
Creates a future from a value. Read more