JobHandler

Trait JobHandler 

Source
pub trait JobHandler: Send + Sync {
    // Required methods
    fn handle<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = JobResult<Value>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn name(&self) -> &'static str;

    // Provided methods
    fn on_failed<'life0, 'life1, 'async_trait>(
        &'life0 self,
        _error: &'life1 JobError,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn on_completed<'life0, 'life1, 'async_trait>(
        &'life0 self,
        _result: &'life1 Value,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
}
Expand description

任务处理器 trait

Required Methods§

Source

fn handle<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = JobResult<Value>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

处理任务

Source

fn name(&self) -> &'static str

获取任务名称

Provided Methods§

Source

fn on_failed<'life0, 'life1, 'async_trait>( &'life0 self, _error: &'life1 JobError, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

任务失败时的钩子

Source

fn on_completed<'life0, 'life1, 'async_trait>( &'life0 self, _result: &'life1 Value, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

任务完成时的钩子

Implementors§