qubit_clock/clock/mock_clock_progression.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//! Progression mode for controllable mock clocks.
11
12/// Controls whether a mock clock stays frozen or progresses with monotonic time.
13///
14/// [`Frozen`](MockClockProgression::Frozen) is the default because deterministic
15/// tests usually need the clock to change only when explicitly advanced.
16/// [`Monotonic`](MockClockProgression::Monotonic) keeps the current logical
17/// reading anchored to an internal monotonic time source, so subsequent reads
18/// naturally progress.
19#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
20pub enum MockClockProgression {
21 /// Keep the logical time frozen until explicitly advanced.
22 #[default]
23 Frozen,
24 /// Progress the logical time using an internal monotonic time source.
25 Monotonic,
26}
27
28impl MockClockProgression {
29 /// Returns `true` when this mode uses monotonic progression.
30 #[inline]
31 pub const fn is_monotonic(self) -> bool {
32 matches!(self, Self::Monotonic)
33 }
34}