pub trait SupervisedTask: Send + 'static {
// Required method
fn run(&mut self) -> impl Future<Output = TaskResult> + Send;
}Expand description
The trait users implement for tasks managed by the supervisor.
§Example
use task_supervisor::{SupervisedTask, TaskResult};
#[derive(Clone)]
struct MyTask;
impl SupervisedTask for MyTask {
async fn run(&mut self) -> TaskResult {
// do work...
Ok(())
}
}Required Methods§
Sourcefn run(&mut self) -> impl Future<Output = TaskResult> + Send
fn run(&mut self) -> impl Future<Output = TaskResult> + Send
Runs the task until completion or failure.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.