Skip to main content

Module time

Module time 

Source
Expand description

Functionality for simulating the passage of time in unit tests.

We do this by providing MockSleepProvider, a β€œSleepProvider” instance that can simulate timeouts and retries without requiring the actual system clock to advance.

Β§Deprecated

This mock time facility has some limitations. See MockSleepProvider for more information. Use MockRuntime for new tests.

Re-exportsΒ§

use std::cmp::Eq; πŸ”’
use std::cmp::Eq; πŸ”’
use std::cmp::Ordering; πŸ”’
use std::cmp::PartialEq; πŸ”’
use std::cmp::PartialEq; πŸ”’
use std::cmp::PartialOrd; πŸ”’
use std::cmp::PartialOrd; πŸ”’
use std::collections::BinaryHeap; πŸ”’
use std::fmt; πŸ”’
use std::pin::Pin; πŸ”’
use std::sync::Arc; πŸ”’
use std::sync::Mutex; πŸ”’
use std::sync::Weak; πŸ”’
use std::task::Context; πŸ”’
use std::task::Poll; πŸ”’
use std::task::Waker; πŸ”’
use web_time_compat::Duration; πŸ”’
use web_time_compat::Instant; πŸ”’
use web_time_compat::InstantExt; πŸ”’
use web_time_compat::SystemTime; πŸ”’
use futures::Future; πŸ”’
use tracing::trace; πŸ”’
use std::collections::HashSet; πŸ”’
use std::fmt::Formatter; πŸ”’
use tor_rtcompat::CoarseInstant; πŸ”’
use tor_rtcompat::CoarseTimeProvider; πŸ”’
use tor_rtcompat::SleepProvider; πŸ”’
use crate::time_core::MockTimeCore; πŸ”’

StructsΒ§

MockSleepProviderDeprecated
A dummy SleepProvider instance for testing.
SleepEntry πŸ”’
An entry telling us when to wake which future up.
SleepSchedule πŸ”’
Shared backend for sleep provider and Sleeping futures.
Sleeping
A future returned by MockSleepProvider::sleep().