use crate::runtime::watch::Watch;
use crate::runtime::Mpsc;
use crate::runtime::MpscUnbounded;
use crate::runtime::Oneshot;
use crate::util::Instant;
use std::fmt::{Debug, Display};
use std::future::Future;
use std::time::Duration;
pub trait AsyncRuntime: Debug + Default + PartialEq + Eq + Send + Sync + 'static {
type Instant: Instant;
type Sleep: Future<Output = ()> + Send + Sync;
type TimeoutError: Debug + Display + Send;
type Timeout<R, T: Future<Output = R> + Send > : Future<Output = Result<R, Self::TimeoutError>> + Send;
type Mpsc: Mpsc;
type MpscUnbounded: MpscUnbounded;
type Oneshot: Oneshot;
type Watch: Watch;
type JoinError: Debug + Display + Send;
type JoinHandle<T: Send + 'static>: Future<Output = Result<T, Self::JoinError>> + Send + Sync + Unpin;
fn spawn<F>(future: F) -> Self::JoinHandle<F::Output>
where
F: Future + Send + 'static,
F::Output: Send + 'static;
fn sleep(duration: Duration) -> Self::Sleep;
fn sleep_until(deadline: Self::Instant) -> Self::Sleep;
fn timeout<R, F: Future<Output = R> + Send>(duration: Duration, future: F) -> Self::Timeout<R, F>;
fn timeout_at<R, F: Future<Output = R> + Send>(deadline: Self::Instant, future: F) -> Self::Timeout<R, F>;
}