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

A future returned by SleepProvider::sleep()

Required methods

Return 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.)

Return 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

Implementors