1use async_trait::async_trait;
5use std::future::Future;
6
7#[async_trait]
10pub trait RuntimeStrategy: Send + Sync {
11 fn spawn<F>(&self, future: F)
13 where
14 F: Future<Output = ()> + Send + 'static;
15
16 }
18
19pub struct LocalStrategy;
20
21#[async_trait]
22impl RuntimeStrategy for LocalStrategy {
23 fn spawn<F>(&self, future: F)
24 where
25 F: Future<Output = ()> + Send + 'static,
26 {
27 tokio::spawn(future);
28 }
29}
30
31pub struct EdgeStrategy;
32
33#[async_trait]
34impl RuntimeStrategy for EdgeStrategy {
35 fn spawn<F>(&self, future: F)
36 where
37 F: Future<Output = ()> + Send + 'static,
38 {
39 tokio::spawn(future);
41 }
42}