use core::{
pin::Pin,
task::{Context, Poll},
time::Duration,
};
#[cfg(feature = "tokio")]
mod tokio;
#[cfg(feature = "tokio")]
pub use self::tokio::Runtime as Tokio;
#[cfg(feature = "async-io")]
mod async_io;
#[cfg(feature = "async-io")]
pub use self::async_io::Runtime as AsyncIo;
pub trait Sleep {
fn reset(self: Pin<&mut Self>, timeout: Duration);
fn poll_sleep(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<()>;
}
pub trait Runtime {
type Sleep: Sleep;
type Instant: Instant;
fn create_sleep(&self, timeout: Duration) -> Self::Sleep;
fn now(&self) -> Self::Instant;
}
pub trait Instant {
fn duration_since(&self, earlier: &Self) -> Duration;
}