pub struct CancellationContext { /* private fields */ }Expand description
A context that provides access to a cancellation token.
This is passed to handlers to allow them to check for cancellation during execution.
Implementations§
Source§impl CancellationContext
impl CancellationContext
Sourcepub fn token(&self) -> &CancellationToken
pub fn token(&self) -> &CancellationToken
Returns the cancellation token for this context.
Sourcepub fn was_cancellation_observed(&self) -> bool
pub fn was_cancellation_observed(&self) -> bool
Returns true once any handler poll has observed cancellation.
Sourcepub fn cancellation_observation_latency(&self) -> Option<Duration>
pub fn cancellation_observation_latency(&self) -> Option<Duration>
Returns the first observed cancellation-poll latency from request to observation.
Trait Implementations§
Source§impl Clone for CancellationContext
impl Clone for CancellationContext
Source§fn clone(&self) -> CancellationContext
fn clone(&self) -> CancellationContext
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 Debug for CancellationContext
impl Debug for CancellationContext
Auto Trait Implementations§
impl Freeze for CancellationContext
impl RefUnwindSafe for CancellationContext
impl Send for CancellationContext
impl Sync for CancellationContext
impl Unpin for CancellationContext
impl UnsafeUnpin for CancellationContext
impl UnwindSafe for CancellationContext
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