pub struct Watch { /* private fields */ }
shutdown
only.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 as Future>::Output where
A: Future + Unpin,
F: FnOnce(&mut A),
pub async fn watch<A, F>(self, future: A, on_drain: F) -> <A as Future>::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 · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more