Skip to main content

qubit_clock/mock/
mod.rs

1/*******************************************************************************
2 *
3 *    Copyright (c) 2025 - 2026 Haixing Hu.
4 *
5 *    SPDX-License-Identifier: Apache-2.0
6 *
7 *    Licensed under the Apache License, Version 2.0.
8 *
9 ******************************************************************************/
10//! Unified mock time runtime.
11//!
12//! This module provides the deterministic test-time model used by mock clocks
13//! and mock sleepers. The central type is [`MockTimeline`], a shared monotonic
14//! elapsed-time source. [`MockClock`] maps that elapsed time onto UTC wall-clock
15//! readings, while [`crate::sleep::MockSleeper`] turns relative sleeps into
16//! waits on the same timeline. [`MockTime`] is the convenience facade for the
17//! common case where one test needs a clock and a sleeper that advance together.
18//!
19//! All mock components are intentionally driven by explicit calls to
20//! [`MockTimeline::advance`] or [`MockTime::advance`]. Real wall-clock time is
21//! used only for test-observability guard timeouts, such as
22//! [`MockTimeline::wait_for_blocked_waiters`], so tests can fail instead of
23//! hanging forever.
24
25mod mock_clock;
26mod mock_instant;
27mod mock_time;
28mod mock_time_error;
29mod mock_timeline;
30mod mock_waiter_kind;
31
32pub use mock_clock::MockClock;
33pub use mock_instant::MockInstant;
34pub use mock_time::MockTime;
35pub use mock_time_error::MockTimeError;
36pub use mock_timeline::MockTimeline;
37pub use mock_waiter_kind::MockWaiterKind;