use std::future::Future;
use std::pin::Pin;
use std::time::{Duration, Instant};
pub type BoxFuture<'a, T> = Pin<Box<dyn Future<Output = T> + Send + 'a>>;
pub type LocalBoxFuture<'a, T> = Pin<Box<dyn Future<Output = T> + 'a>>;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct NotLocal;
pub trait Executor: Send + Sync + 'static {
fn spawn(&self, fut: BoxFuture<'static, ()>);
fn spawn_local(&self, fut: LocalBoxFuture<'static, ()>) -> Result<(), NotLocal>;
fn spawn_blocking(&self, f: Box<dyn FnOnce() + Send>);
fn sleep(&self, d: Duration) -> BoxFuture<'static, ()>;
fn now(&self) -> Instant;
}