pub struct CtrlCHandle { /* private fields */ }Expand description
A trigger for a CtrlC handle created via CtrlC::manual – the HTTP-triggered
equivalent of a real Ctrl+C keypress. Deliberately a thin wrapper around the same
watch::Sender<u32> mechanism #[cfg(test)]’s test_pair() already uses internally,
rather than a second, parallel cancellation mechanism: CtrlC::signalled can’t tell the
two apart, so execute/run_polling_loop/attempt_restore need no changes at all to
support HTTP-triggered cancellation.
Clone so a caller can store one copy in a run registry (to answer a later
POST /api/runs/{id}/cancel) while another copy is held by whatever’s waiting to trigger
it on graceful shutdown.
Implementations§
Source§impl CtrlCHandle
impl CtrlCHandle
Sourcepub fn trigger(&self)
pub fn trigger(&self)
Requests cancellation, exactly as if Ctrl+C had been pressed. Safe to call more than
once – a second call is exactly what lets a caller model a “second Ctrl+C” hard-exit
request arriving during an already-in-flight restore, matching safety-cancellation’s
interactive CLI behavior (see AGENTS.md) – and safe to call after the paired
CtrlC has already been dropped (the run this handle was for has already ended):
[watch::Sender::send_modify] never fails, unlike send, so there is nothing to
propagate or ignore.
Trait Implementations§
Source§impl Clone for CtrlCHandle
impl Clone for CtrlCHandle
Source§fn clone(&self) -> CtrlCHandle
fn clone(&self) -> CtrlCHandle
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for CtrlCHandle
impl RefUnwindSafe for CtrlCHandle
impl Send for CtrlCHandle
impl Sync for CtrlCHandle
impl Unpin for CtrlCHandle
impl UnsafeUnpin for CtrlCHandle
impl UnwindSafe for CtrlCHandle
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,
§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>
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§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].