pub struct Cancel { /* private fields */ }Expand description
A handle for stopping a run from another thread.
Cheap to clone (one Arc), which is the point: the thread running the task
holds one, and so does whatever is listening for the request to stop.
Implementations§
Source§impl Cancel
impl Cancel
pub fn new() -> Self
Sourcepub fn cancel(&self)
pub fn cancel(&self)
Stop the run: signal whatever is running now, and refuse to start any further step.
Idempotent, and safe to call when nothing is running (a run cancelled between steps simply never starts the next one).
Sourcepub fn is_cancelled(&self) -> bool
pub fn is_cancelled(&self) -> bool
Whether cancel has been called.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Cancel
impl RefUnwindSafe for Cancel
impl Send for Cancel
impl Sync for Cancel
impl Unpin for Cancel
impl UnsafeUnpin for Cancel
impl UnwindSafe for Cancel
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