Continuation

Trait Continuation 

Source
pub trait Continuation:
    Send
    + Sync
    + Debug
    + Any {
    // Required method
    fn execute<'life0, 'async_trait>(
        &'life0 self,
        cancel_token: CancellationToken,
    ) -> Pin<Box<dyn Future<Output = TaskExecutionResult<Box<dyn Any + Send + 'static>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Trait for continuation tasks that execute after a failure

This trait allows tasks to define what should happen next after a failure, eliminating the need for complex type erasure and executor management. Tasks implement this trait to provide clean continuation logic.

Required Methods§

Source

fn execute<'life0, 'async_trait>( &'life0 self, cancel_token: CancellationToken, ) -> Pin<Box<dyn Future<Output = TaskExecutionResult<Box<dyn Any + Send + 'static>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Execute the continuation task after a failure

This method is called when a task fails and a continuation is provided. The implementation can perform retry logic, fallback operations, transformations, or any other follow-up action. Returns the result in a type-erased Box for flexibility.

Implementors§