pub trait Cancel {
// Required methods
fn try_cancel(&mut self) -> CancelResult;
fn cancel(&mut self) -> CancelOp<'_> ⓘ;
}
Expand description
Cancelation of an in progress operations.
Required Methods§
sourcefn try_cancel(&mut self) -> CancelResult
fn try_cancel(&mut self) -> CancelResult
Attempt to cancel this operation.
The cancelation attempt will be done asynchronously, without returning
the result. If you want to know the result of the cancelation attempt
use cancel
instead.
sourcefn cancel(&mut self) -> CancelOp<'_> ⓘ
fn cancel(&mut self) -> CancelOp<'_> ⓘ
Cancel this operation.
If this returns ENOENT
it means the operation was not found. This can
be caused by the operation never starting, due to the inert nature of
Future
s, or the operation has already been completed.
If this returns EALREADY
it means the operation was found, but it was
already canceled previously.
If the operation was found and canceled this returns Ok(())
.
If this is called on an AsyncIterator
it will cause them to return
None
(eventually, it may still return pending items).