pub trait TaskRunner:
Send
+ Sync
+ 'static {
type Output: Send + 'static;
// Required method
fn run<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Self::Output, Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
Trait for implementing custom task runners.
Users implement this trait to define what their scheduled task does. The task runner is executed when the scheduled time arrives.
Required Associated Types§
Required Methods§
Sourcefn run<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Self::Output, Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn run<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Self::Output, Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Executes the task.
§Returns
Ok(Self::Output)- On successful executionErr(Box<dyn std::error::Error + Send + Sync>)- On failure