AsyncTask

Trait AsyncTask 

Source
pub trait AsyncTask: Send + Sync {
    // Required method
    fn run<'life0, 'async_trait>(
        &'life0 self,
        cancel: CancellationToken,
    ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Trait for tasks that can be run asynchronously, with the Task Manager

Required Methods§

Source

fn run<'life0, 'async_trait>( &'life0 self, cancel: CancellationToken, ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

The actual async task / work / job

  • cancel - Tokio CancellationToken (re-exported by this crate) to stop a run See query demo app for one example usage to interrupt async run operations. This is a child token that can only cancel this one task run, not the entire loop.

Implementors§