pub struct CancelToken { /* private fields */ }Expand description
A cooperative cancellation flag shared between a query’s caller and the worker executing it (ADR-0111).
Cloning shares the same underlying flag, so a transport can cancel a query
it did not start. A CancelToken that is never cancelled lets a query run
to completion, which is how crate::Error’s callers that do not care
about cancellation use it.
use relate_core::CancelToken;
let token = CancelToken::new();
assert!(!token.is_cancelled());
let transport = token.clone();
transport.cancel();
assert!(token.is_cancelled());Implementations§
Source§impl CancelToken
impl CancelToken
Sourcepub fn is_cancelled(&self) -> bool
pub fn is_cancelled(&self) -> bool
Whether Self::cancel has been called on this token or any clone.
Trait Implementations§
Source§impl Clone for CancelToken
impl Clone for CancelToken
Source§impl Debug for CancelToken
impl Debug for CancelToken
Auto Trait Implementations§
impl Forget for CancelToken
impl Freeze for CancelToken
impl Move 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