pub struct Stop { /* private fields */ }Expand description
A cooperative stop, shared with whoever asked the loop to run.
Cloning is how the request travels: serve_until keeps one handle, the
Ctrl-C listener and the web UI keep others, and every clone points at the
same flag. There is no channel because there is nothing to send — the only
message is “stop”, it is idempotent, and a flag cannot be missed by a
receiver that was not listening yet.
The handle also answers the question the operator’s screen asks next: a
stop does not take effect until the run in flight has finished, so
Stop::finishing reports “asked to stop, still working” rather than
leaving a caller to infer it from a heartbeat and hope.
Implementations§
Source§impl Stop
impl Stop
Sourcepub fn stop(&self)
pub fn stop(&self)
Ask the loop to stop. Idempotent, and safe to call before the loop starts: the flag is checked before the first poll.
Sourcepub fn finishing(&self) -> bool
pub fn finishing(&self) -> bool
Has a stop been asked for that has not taken effect yet, because a run is still in flight?
This is the state a screen has to be able to show. A stop never abandons
a run — see serve_until — so between the tap and the loop’s return
there is a window of tens of minutes in which “running” and “stopped”
are both misleading answers.
Sourcepub fn park(&self)
pub fn park(&self)
Ask the loop to stop and the run in flight to park at its next node boundary.
The plain Stop::stop never abandons a run, which is right when the
operator only wants the queue to drain: a competition is tens of
minutes and its worktrees are paid for. But an operator who wants to
replace the binary cannot wait out a run that has an hour left, and
killing the process loses whatever the seats in flight had not written.
Parking costs at most the node in progress and leaves the run
resumable.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Stop
impl RefUnwindSafe for Stop
impl Send for Stop
impl Sync for Stop
impl Unpin for Stop
impl UnsafeUnpin for Stop
impl UnwindSafe for Stop
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§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<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> ⓘ
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> ⓘ
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