pub struct CancelFlag { /* private fields */ }Expand description
Shared cancel flag checked by HTTP retries between attempts.
Stores the first observed CancelKind so cooperative checks can surface
exit 130 vs 143 correctly (first cancel wins).
§Interior mutability
Cross-task flag (Arc<AtomicU8>): signal waiter, wall-clock path, and HTTP
pollers share one flag. An atomic is the right primitive (not Mutex<u8> /
Cell — multi-task, single primitive, no compound invariant).
Ordering is Ordering::SeqCst on every load/store/CAS so first-writer-wins
is totally ordered against cooperative check without a separate fence story.
Implementations§
Source§impl CancelFlag
impl CancelFlag
Sourcepub fn cancel(&self)
pub fn cancel(&self)
Marks the flag as cancelled with CancelKind::Terminate (generic cancel).
Sourcepub fn cancel_with(&self, kind: CancelKind)
pub fn cancel_with(&self, kind: CancelKind)
Marks the flag as cancelled with an explicit signal kind.
First writer wins; subsequent calls are no-ops (idempotent).
CAS uses SeqCst success/failure orderings (see type docs).
Sourcepub fn is_cancelled(&self) -> bool
pub fn is_cancelled(&self) -> bool
Returns whether cancellation was requested.
Sourcepub fn kind(&self) -> Option<CancelKind>
pub fn kind(&self) -> Option<CancelKind>
Returns the stored kind when cancelled.
Sourcepub fn check(&self) -> AppResult<()>
pub fn check(&self) -> AppResult<()>
Returns AppError::interrupted or AppError::terminated when cancelled.
§Errors
Returns ErrorKind::Interrupted or ErrorKind::Terminated when the flag is set.
Trait Implementations§
Source§impl Clone for CancelFlag
impl Clone for CancelFlag
Source§fn clone(&self) -> CancelFlag
fn clone(&self) -> CancelFlag
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CancelFlag
impl Debug for CancelFlag
Source§impl Default for CancelFlag
impl Default for CancelFlag
Source§fn default() -> CancelFlag
fn default() -> CancelFlag
Auto Trait Implementations§
impl Freeze for CancelFlag
impl RefUnwindSafe for CancelFlag
impl Send for CancelFlag
impl Sync for CancelFlag
impl Unpin for CancelFlag
impl UnsafeUnpin for CancelFlag
impl UnwindSafe for CancelFlag
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