pub trait Task: Send + Sync {
// Required method
fn execute<'life0, 'life1, 'async_trait>(
&'life0 mut self,
state: &'life1 mut State,
) -> Pin<Box<dyn Future<Output = Result<Transition, Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}Expand description
Executable task
Automatons execute a series of tasks. Each task should only perform a single, logical step and then return the next task.
Tasks can share data with each other by putting it into the shared state.
If a task determines that no more work needs to be done, it can complete the automaton early by
returning a Transition with the Complete variant.
Required Methods§
Sourcefn execute<'life0, 'life1, 'async_trait>(
&'life0 mut self,
state: &'life1 mut State,
) -> Pin<Box<dyn Future<Output = Result<Transition, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn execute<'life0, 'life1, 'async_trait>(
&'life0 mut self,
state: &'life1 mut State,
) -> Pin<Box<dyn Future<Output = Result<Transition, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Executes the task.
Tasks can perform arbitrary units of work. They are executed asynchronously to avoid
blocking the thread when waiting for external resources. Tasks return a Result with a
Transition, which tells the engine whether to continue, handle an unexpected failure, or
return early since there is no more work to be done.