Skip to main content

Module mock

Module mock 

Source
Expand description

Unified mock time runtime.

This module provides the deterministic test-time model used by mock clocks and mock sleepers. The central type is MockTimeline, a shared monotonic elapsed-time source. MockClock maps that elapsed time onto UTC wall-clock readings, while crate::sleep::MockSleeper turns relative sleeps into waits on the same timeline. MockTime is the convenience facade for the common case where one test needs a clock and a sleeper that advance together.

All mock components are intentionally driven by explicit calls to MockTimeline::advance or MockTime::advance. Real wall-clock time is used only for test-observability guard timeouts, such as MockTimeline::wait_for_blocked_waiters, so tests can fail instead of hanging forever.

Structs§

MockClock
Clock implementation whose readings are derived from a shared mock timeline.
MockInstant
A monotonic instant measured from a crate::MockTimeline origin.
MockTime
A complete mock time runtime sharing one timeline across clocks and sleepers.
MockTimeline
Shared monotonic time source for deterministic tests.

Enums§

MockTimeError
Error returned when a mock time control operation is rejected.
MockWaiterKind
Identifies waiter groups tracked by crate::MockTimeline.