Trait tor_rtcompat::SleepProvider [−][src]
pub trait SleepProvider {
type SleepFuture: Future<Output = ()> + Send + 'static;
fn sleep(&self, duration: Duration) -> Self::SleepFuture;
fn now(&self) -> Instant { ... }
fn wallclock(&self) -> SystemTime { ... }
}Expand description
Trait for a runtime that can wait until a timer has expired.
Every SleepProvider also implements crate::SleepProviderExt;
see that trait for other useful functions.
Associated Types
type SleepFuture: Future<Output = ()> + Send + 'static
type SleepFuture: Future<Output = ()> + Send + 'staticA future returned by SleepProvider::sleep()
Required methods
fn sleep(&self, duration: Duration) -> Self::SleepFuture
fn sleep(&self, duration: Duration) -> Self::SleepFutureReturn a future that will be ready after duration has
elapsed.
Provided methods
Return the SleepProvider’s view of the current instant.
(This is the same as Instant::now, if not running in test mode.)
fn wallclock(&self) -> SystemTime
fn wallclock(&self) -> SystemTimeReturn the SleepProvider’s view of the current wall-clock time.
(This is the same as SystemTime::now, if not running in test mode.)
Implementations on Foreign Types
type SleepFuture = Sleep