Skip to main content

TaskRunner

Trait TaskRunner 

Source
pub trait TaskRunner: Send + Sync {
    // Required method
    fn run<'life0, 'async_trait>(
        &'life0 self,
        tasks: Vec<BoxFuture<'static, ()>>,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Runs all tasks and returns after all complete.

Contract for implementations:

  • the future returned by run must not complete before every task has completed;
  • dropping that future before it completes cancels the tasks that are still running (Rust cancellation): no task may outlive the call that started it.

Required Methods§

Source

fn run<'life0, 'async_trait>( &'life0 self, tasks: Vec<BoxFuture<'static, ()>>, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Runs every task and returns once all of them have completed. Dropping the returned future cancels the tasks still running.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§