pub struct CancellationScope { /* private fields */ }Expand description
Cooperative cancellation scope for an owned operation and its children.
The implementation wraps Tokio internally, while the public contract does not expose Tokio tokens, runtime handles, channels, or tasks. Cancellation is idempotent and propagates from parent scopes to children.
Implementations§
Source§impl CancellationScope
impl CancellationScope
Sourcepub fn child(&self) -> Self
pub fn child(&self) -> Self
Creates a child cancelled when this parent is cancelled.
Cancelling the child does not cancel this parent.
Sourcepub fn is_cancelled(&self) -> bool
pub fn is_cancelled(&self) -> bool
Returns whether cancellation has been requested.
Trait Implementations§
Source§impl Clone for CancellationScope
impl Clone for CancellationScope
Source§fn clone(&self) -> CancellationScope
fn clone(&self) -> CancellationScope
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 CancellationScope
impl Debug for CancellationScope
Auto Trait Implementations§
impl Freeze for CancellationScope
impl RefUnwindSafe for CancellationScope
impl Send for CancellationScope
impl Sync for CancellationScope
impl Unpin for CancellationScope
impl UnsafeUnpin for CancellationScope
impl UnwindSafe for CancellationScope
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