pub struct CancellationHandle { /* private fields */ }Expand description
Read-only view of cancellation state, cheaply cloneable.
The loop and tool executors receive a CancellationHandle and use it to
create TurnCancellation checkpoints or poll for interrupts directly.
Obtain one from CancellationController::handle.
Implementations§
Source§impl CancellationHandle
impl CancellationHandle
Sourcepub fn generation(&self) -> u64
pub fn generation(&self) -> u64
Returns the current generation counter.
Sourcepub fn checkpoint(&self) -> TurnCancellation
pub fn checkpoint(&self) -> TurnCancellation
Creates a TurnCancellation checkpoint capturing the current generation.
Sourcepub fn is_cancelled_since(&self, generation: u64) -> bool
pub fn is_cancelled_since(&self, generation: u64) -> bool
Returns true if the generation has changed since generation.
§Arguments
generation- The generation value to compare against, typically obtained from a prior call togeneration.
Sourcepub async fn cancelled_since(&self, generation: u64)
pub async fn cancelled_since(&self, generation: u64)
Waits asynchronously until the generation changes from generation.
Polls the generation counter every 10 ms. Prefer using
TurnCancellation::cancelled instead, which captures the generation
automatically.
§Arguments
generation- The generation value to wait for a change from.
Trait Implementations§
Source§impl Clone for CancellationHandle
impl Clone for CancellationHandle
Source§fn clone(&self) -> CancellationHandle
fn clone(&self) -> CancellationHandle
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Default for CancellationHandle
impl Default for CancellationHandle
Source§fn default() -> CancellationHandle
fn default() -> CancellationHandle
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for CancellationHandle
impl RefUnwindSafe for CancellationHandle
impl Send for CancellationHandle
impl Sync for CancellationHandle
impl Unpin for CancellationHandle
impl UnsafeUnpin for CancellationHandle
impl UnwindSafe for CancellationHandle
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