pub trait Task: Send + Sync {
// Required methods
fn execute<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = TaskResult> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn task_type(&self) -> &'static str;
fn task_id(&self) -> String;
// Provided methods
fn estimated_duration(&self) -> Option<Duration> { ... }
fn description(&self) -> String { ... }
}
Expand description
Trait defining a unit of work that can be executed asynchronously.
All tasks in the parallel processing system must implement this trait to provide execution logic and metadata.
Required Methods§
Provided Methods§
Sourcefn estimated_duration(&self) -> Option<Duration>
fn estimated_duration(&self) -> Option<Duration>
Returns an estimated duration for the task execution.
Sourcefn description(&self) -> String
fn description(&self) -> String
Returns a human-readable description of the task.