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