Trait Abortable
pub trait Abortable {
// Required methods
fn abort_task(&self);
fn was_aborted(&self) -> bool;
}Expand description
Abstraction over tasks that can be aborted (such as join or abort handles).
Required Methods§
fn abort_task(&self)
fn abort_task(&self)
Notifies the task that it should abort.
Must be idempotent and not panic if it was already called before, due to implementation-specific
semantics of Abortable::was_aborted.
fn was_aborted(&self) -> bool
fn was_aborted(&self) -> bool
Returns true if abort_task was already called or the task has finished.
It is implementation-specific whether true actually means that the task has been finished.
The Abortable::abort_task therefore can be also called if true is returned without a consequence.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
§impl Abortable for AbortHandle
impl Abortable for AbortHandle
fn abort_task(&self)
fn was_aborted(&self) -> bool
§impl Abortable for JoinHandle<()>
Available on crate feature runtime-tokio only.
impl Abortable for JoinHandle<()>
Available on crate feature
runtime-tokio only.