pub mod driver;
pub use driver::EndpointDriver;
use std::future::Future;
use std::pin::Pin;
use std::time::Duration;
pub trait Runtime: Send + Sync + 'static {
fn spawn(&self, future: Pin<Box<dyn Future<Output = ()> + Send>>);
fn sleep(&self, duration: Duration) -> Pin<Box<dyn Future<Output = ()> + Send>>;
}
#[derive(Clone, Copy, Debug, Default)]
pub struct TokioRuntime;
impl Runtime for TokioRuntime {
fn spawn(&self, future: Pin<Box<dyn Future<Output = ()> + Send>>) {
tokio::spawn(future);
}
fn sleep(&self, duration: Duration) -> Pin<Box<dyn Future<Output = ()> + Send>> {
Box::pin(tokio::time::sleep(duration))
}
}