Task

Trait Task 

Source
pub trait Task: Send + Sync {
    type Input: Serialize + for<'de> Deserialize<'de> + Send;
    type Output: Serialize + for<'de> Deserialize<'de> + Send;

    // Required methods
    fn execute<'life0, 'async_trait>(
        &'life0 self,
        input: Self::Input,
    ) -> Pin<Box<dyn Future<Output = Result<Self::Output>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn name(&self) -> &str;
}
Expand description

Trait for tasks that can be executed

Required Associated Types§

Source

type Input: Serialize + for<'de> Deserialize<'de> + Send

The input type for this task

Source

type Output: Serialize + for<'de> Deserialize<'de> + Send

The output type for this task

Required Methods§

Source

fn execute<'life0, 'async_trait>( &'life0 self, input: Self::Input, ) -> Pin<Box<dyn Future<Output = Result<Self::Output>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Execute the task with the given input

Source

fn name(&self) -> &str

Get the task name

Implementors§