pub struct CancelToken { /* private fields */ }Expand description
A cloneable handle over a shared cancellation flag.
Clones share the same underlying flag: cancelling any clone is observed by all of them. This is what lets the stream layer hold one handle while the executor holds another and still agree on whether to stop.
Implementations§
Source§impl CancelToken
impl CancelToken
Sourcepub fn cancel(&self)
pub fn cancel(&self)
Raise the cancel signal. Idempotent — cancelling an already-cancelled token is a no-op. Visible to every clone of this token.
Sourcepub fn is_cancelled(&self) -> bool
pub fn is_cancelled(&self) -> bool
true once any clone of this token has been cancelled.
Trait Implementations§
Source§impl Clone for CancelToken
impl Clone for CancelToken
Source§impl Debug for CancelToken
impl Debug for CancelToken
Auto Trait Implementations§
impl Freeze for CancelToken
impl RefUnwindSafe for CancelToken
impl Send for CancelToken
impl Sync for CancelToken
impl Unpin for CancelToken
impl UnsafeUnpin for CancelToken
impl UnwindSafe for CancelToken
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