pub struct CancelToken { /* private fields */ }Expand description
The producer’s handle on a consumer’s cancel token, accepted as the final
parameter of a #[weaveffi::cancellable] async fn.
The handle holds its own reference to the token, so it stays valid after
the consumer destroys its reference. Cancellation is enforced by the
runtime (the producer’s future is dropped as soon as the token fires); a
producer polls is_cancelled only when it wants to
clean up cooperatively, for example between batches of work on another
thread.
Implementations§
Source§impl CancelToken
impl CancelToken
Sourcepub fn is_cancelled(&self) -> bool
pub fn is_cancelled(&self) -> bool
Whether the consumer has requested cancellation.
Trait Implementations§
Source§impl Clone for CancelToken
impl Clone for CancelToken
Source§impl Debug for CancelToken
impl Debug for CancelToken
Source§impl Default for CancelToken
impl Default for CancelToken
Source§fn default() -> CancelToken
fn default() -> CancelToken
Returns the “default value” for a type. Read more
Source§impl Drop for CancelToken
impl Drop 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