Skip to main content

JoinHandle

Trait JoinHandle 

Source
pub trait JoinHandle: Send + Debug {
    // Required methods
    fn abort(&self);
    fn is_finished(&self) -> bool;
    fn poll_join(&mut self, cx: &mut Context<'_>) -> Poll<()>;
}
Expand description

A task spawned with Runtime::spawn. Dropping it detaches the task.

Required Methods§

Source

fn abort(&self)

Cancels the task (it is dropped at its next await point, or before it starts).

Source

fn is_finished(&self) -> bool

Whether the task has ended (finished or cancelled).

Source

fn poll_join(&mut self, cx: &mut Context<'_>) -> Poll<()>

Ready once the task has ended.

Implementations§

Source§

impl<'a> dyn JoinHandle + 'a

Source

pub fn join(&mut self) -> impl Future<Output = ()> + '_

Waits for the task to end.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§