use async_trait::async_trait;
use std::future::Future;
#[async_trait]
pub trait RuntimeStrategy: Send + Sync {
fn spawn<F>(&self, future: F)
where
F: Future<Output = ()> + Send + 'static;
}
pub struct LocalStrategy;
#[async_trait]
impl RuntimeStrategy for LocalStrategy {
fn spawn<F>(&self, future: F)
where
F: Future<Output = ()> + Send + 'static,
{
tokio::spawn(future);
}
}
pub struct EdgeStrategy;
#[async_trait]
impl RuntimeStrategy for EdgeStrategy {
fn spawn<F>(&self, future: F)
where
F: Future<Output = ()> + Send + 'static,
{
tokio::spawn(future);
}
}