use anyhow::Result;
use std::future::Future;
pub trait TaskFactory {
type Task: Future<Output = Result<()>> + Send + 'static;
fn create(&self) -> Self::Task;
}
impl<F, Task> TaskFactory for F
where
F: Fn() -> Task,
Task: Future<Output = Result<()>> + Send + 'static,
{
type Task = Task;
fn create(&self) -> Self::Task {
self()
}
}