pub struct Watch { /* private fields */ }
Expand description
Watch for a drain command.
All Watch
instances must be dropped for a Signal::signal
call to
complete.
Implementations
sourceimpl Watch
impl Watch
sourcepub async fn signaled(self) -> ReleaseShutdown
pub async fn signaled(self) -> ReleaseShutdown
Returns a ReleaseShutdown
handle after the drain has been signaled. The
handle must be dropped when a shutdown action has been completed to
unblock graceful shutdown.
sourcepub fn ignore_signaled(self) -> ReleaseShutdown
pub fn ignore_signaled(self) -> ReleaseShutdown
Return a ReleaseShutdown
handle immediately, ignoring the release signal.
This is intended to allow a task to block shutdown until it completes.
sourcepub async fn watch<A, F>(self, future: A, on_drain: F) -> A::Output where
A: Future + Unpin,
F: FnOnce(&mut A),
pub async fn watch<A, F>(self, future: A, on_drain: F) -> A::Output where
A: Future + Unpin,
F: FnOnce(&mut A),
Wrap a future and a callback that is triggered when drain is received.
The callback receives a mutable reference to the original future, and should be used to trigger any shutdown process for it.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Watch
impl Send for Watch
impl Sync for Watch
impl Unpin for Watch
impl !UnwindSafe for Watch
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more