|
|
|
@ -60,25 +60,24 @@ pub(crate) trait Context {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[cfg(all(not(target_os = "unknown"), feature = "default"))]
|
|
|
|
|
pub(crate) type Timer = smol::Timer;
|
|
|
|
|
mod timer {
|
|
|
|
|
pub type Timer = smol::Timer;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[cfg(any(all(target_arch = "wasm32", feature = "default"), feature = "unstable"))]
|
|
|
|
|
mod timer {
|
|
|
|
|
use std::pin::Pin;
|
|
|
|
|
use std::task::Poll;
|
|
|
|
|
|
|
|
|
|
#[cfg(all(target_arch = "wasm32", feature = "default"))]
|
|
|
|
|
#[derive(Debug)]
|
|
|
|
|
pub(crate) struct Timer(futures_timer::Delay);
|
|
|
|
|
|
|
|
|
|
#[cfg(all(target_arch = "wasm32", feature = "default"))]
|
|
|
|
|
impl Timer {
|
|
|
|
|
pub(crate) fn after(dur: std::time::Duration) -> Self {
|
|
|
|
|
Timer(futures_timer::Delay::new(dur))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[cfg(target_arch = "wasm32")]
|
|
|
|
|
use std::pin::Pin;
|
|
|
|
|
#[cfg(target_arch = "wasm32")]
|
|
|
|
|
use std::task::Poll;
|
|
|
|
|
|
|
|
|
|
#[cfg(target_arch = "wasm32")]
|
|
|
|
|
impl std::future::Future for Timer {
|
|
|
|
|
type Output = ();
|
|
|
|
|
|
|
|
|
@ -89,6 +88,9 @@ impl std::future::Future for Timer {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub(crate) use timer::*;
|
|
|
|
|
|
|
|
|
|
/// Defers evaluation of a block of code until the end of the scope.
|
|
|
|
|
#[cfg(feature = "default")]
|
|
|
|
|