pub struct Cancellation { /* private fields */ }Expand description
Explicit cancellation authority and observer for one lifetime.
There is deliberately no global token or ambient lookup. Hosts construct a root, derive children for owned work, and pass those values explicitly.
Implementations§
Source§impl Cancellation
impl Cancellation
Sourcepub fn child(&self) -> Self
pub fn child(&self) -> Self
Constructs an open child which follows this token’s terminal state.
Sourcepub fn cancel(&self, reason: CancellationReason) -> bool
pub fn cancel(&self, reason: CancellationReason) -> bool
Performs the sole open-to-cancelled transition, returning true only to its winner.
Sourcepub fn reason(&self) -> Option<CancellationReason>
pub fn reason(&self) -> Option<CancellationReason>
Observes the terminal reason without blocking.
Sourcepub fn is_cancelled(&self) -> bool
pub fn is_cancelled(&self) -> bool
Returns whether the terminal transition has occurred.
Sourcepub fn cancelled(&self) -> CancellationWaiter ⓘ
pub fn cancelled(&self) -> CancellationWaiter ⓘ
Registers an executor-neutral waiter for the terminal reason.
Trait Implementations§
Source§impl Clone for Cancellation
impl Clone for Cancellation
Source§fn clone(&self) -> Cancellation
fn clone(&self) -> Cancellation
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Cancellation
impl Debug for Cancellation
Auto Trait Implementations§
impl Freeze for Cancellation
impl RefUnwindSafe for Cancellation
impl Send for Cancellation
impl Sync for Cancellation
impl Unpin for Cancellation
impl UnsafeUnpin for Cancellation
impl UnwindSafe for Cancellation
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
Mutably borrows from an owned value. Read more