pub struct VirtualClock { /* private fields */ }Expand description
A virtual clock for simulation: time is a counter the scheduler
advances, plus a fixed wall-clock base so epoch_now stays
meaningful for expiry math.
Implementations§
Source§impl VirtualClock
impl VirtualClock
Sourcepub fn new(epoch_base: Epoch) -> Arc<Self>
pub fn new(epoch_base: Epoch) -> Arc<Self>
A virtual clock starting at epoch_base (the simulated wall
time at virtual zero).
Sourcepub fn advance(&self, d: Duration)
pub fn advance(&self, d: Duration)
Advance virtual time by d. Called only by the simulation
scheduler, between event deliveries.
Sourcepub fn reset(&self)
pub fn reset(&self)
Rewind virtual time to zero. ONLY sound between independent
simulation runs in one process (each run constructs its whole
world fresh, so no live state carries Mono values across the
reset). Lets a test binary execute the same seeded scenario
twice and get bit-identical wall-clock-dependent artifacts
(commit timestamps, cap expiries) — the determinism-replay
contract.
Auto Trait Implementations§
impl !Freeze for VirtualClock
impl RefUnwindSafe for VirtualClock
impl Send for VirtualClock
impl Sync for VirtualClock
impl Unpin for VirtualClock
impl UnsafeUnpin for VirtualClock
impl UnwindSafe for VirtualClock
Blanket Implementations§
impl<T> ArchiveOwner for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<S, T> IntoEncoded<S> for Twhere
S: Encodes<T>,
impl<S, T> IntoEncoded<S> for Twhere
S: Encodes<T>,
Source§fn into_encoded(self) -> <T as IntoEncoded<S>>::Output
fn into_encoded(self) -> <T as IntoEncoded<S>>::Output
Run the conversion.