pub struct VirtualClock { /* private fields */ }Expand description
Virtual wall, elapsed and scheduler clocks. Scheduler time is what timers are registered against; it moves only when a history delivers timers, so a silent shift never fires a deliberately held timer.
Implementations§
Source§impl VirtualClock
impl VirtualClock
Sourcepub fn new(wall_ms: i64) -> Arc<Self> ⓘ
pub fn new(wall_ms: i64) -> Arc<Self> ⓘ
A clock at wall_ms epoch milliseconds with zero elapsed and
scheduler time.
Sourcepub fn shift(&self, delta_ms: i64, wall_only: bool)
pub fn shift(&self, delta_ms: i64, wall_only: bool)
Move wall (and unless wall_only, elapsed) time without delivering timers.
Sourcepub fn shift_ns(&self, delta_ns: i128, wall_only: bool)
pub fn shift_ns(&self, delta_ns: i128, wall_only: bool)
shift in nanoseconds; elapsed time saturates at zero.
Sourcepub fn pending_timers(&self) -> usize
pub fn pending_timers(&self) -> usize
Timers registered and neither fired nor dropped.
Trait Implementations§
Source§impl Clock for VirtualClock
impl Clock for VirtualClock
Auto Trait Implementations§
impl !Freeze for VirtualClock
impl !RefUnwindSafe for VirtualClock
impl !UnwindSafe for VirtualClock
impl Send for VirtualClock
impl Sync for VirtualClock
impl Unpin for VirtualClock
impl UnsafeUnpin for VirtualClock
Blanket Implementations§
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