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§
Sourcefn 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.
Sourcefn 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.
Implementations on Foreign Types§
Source§impl<'a, T: 'a + Abortable + ?Sized> Abortable for &'a T
impl<'a, T: 'a + Abortable + ?Sized> Abortable for &'a T
fn abort_task(&self)
fn was_aborted(&self) -> bool
Source§impl<T: Abortable + ?Sized> Abortable for Box<T>
impl<T: Abortable + ?Sized> Abortable for Box<T>
fn abort_task(&self)
fn was_aborted(&self) -> bool
Source§impl<T: Abortable + ?Sized> Abortable for Arc<T>
impl<T: Abortable + ?Sized> Abortable for Arc<T>
fn abort_task(&self)
fn was_aborted(&self) -> bool
Implementors§
impl Abortable for JoinHandle<()>
Available on crate feature
runtime-tokio only.