pub struct Stopping(pub(crate) Receiver<bool>);Expand description
One observation of the stop signal for a whole run, installed once at its start and awaited by everything that stops on it.
A handler installed partway through startup misses a stop sent before
it. This one remembers: a stop that arrived while startup was busy is
still there for Stopping::wait when serving begins.
Tuple Fields§
§0: Receiver<bool>Implementations§
Source§impl Stopping
impl Stopping
Sourcepub fn when(stopped: Receiver<bool>) -> Self
pub fn when(stopped: Receiver<bool>) -> Self
A stop that arrives once stopped reads true, for a caller that
decides for itself when a run stops.
Sourcepub fn after(self, work: impl Future<Output = ()> + Send + 'static) -> Self
pub fn after(self, work: impl Future<Output = ()> + Send + 'static) -> Self
This stop, arriving only once work has run after it.
For what has to happen while the process still serves: everything
that waits on the returned one keeps going until work is done.
work is not polled before the stop arrives.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Stopping
impl RefUnwindSafe for Stopping
impl Send for Stopping
impl Sync for Stopping
impl Unpin for Stopping
impl UnsafeUnpin for Stopping
impl UnwindSafe for Stopping
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more