pub struct ManualClock(/* private fields */);Expand description
A clock that only moves when told to: for tests and simulations.
Set and advance it through a shared reference while the code under test
reads it through &dyn Clock.
Implementations§
Source§impl ManualClock
impl ManualClock
Sourcepub const fn new(now: SystemTime) -> Self
pub const fn new(now: SystemTime) -> Self
Creates a clock stopped at now.
Sourcepub fn set(&self, now: SystemTime)
pub fn set(&self, now: SystemTime)
Moves the clock to now (backwards too).
Trait Implementations§
Source§impl Clock for ManualClock
impl Clock for ManualClock
Source§fn now(&self) -> SystemTime
fn now(&self) -> SystemTime
Returns the current wall-clock time.
Auto Trait Implementations§
impl !Freeze for ManualClock
impl RefUnwindSafe for ManualClock
impl Send for ManualClock
impl Sync for ManualClock
impl Unpin for ManualClock
impl UnsafeUnpin for ManualClock
impl UnwindSafe for ManualClock
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