Skip to main content

Task

Trait Task 

Source
pub trait Task<Out>: Future
where Out: Send + 'static,
{ // Required methods fn output<'async_trait>( self, ) -> Pin<Box<dyn Future<Output = Out> + Send + 'async_trait>> where Self: 'async_trait; fn detach(self); fn drop(self); }
Expand description

Trait representing an async task that can be awaited.

This trait combines the Future trait with methods for managing task lifecycle.

§Type Parameters

  • Out - The output type of the task

Required Methods§

Source

fn output<'async_trait>( self, ) -> Pin<Box<dyn Future<Output = Out> + Send + 'async_trait>>
where Self: 'async_trait,

Consumes the task and returns its output.

Source

fn detach(self)

Detaches the task, allowing it to run independently.

Source

fn drop(self)

Drops the task, cancelling it if not detached.

Implementors§