pub struct ManualClock { /* private fields */ }Expand description
A fake clock for tests: time moves only when you tell it to; sleeping just advances it.
Use 1000.0 as the start to match the other languages’ default.
Implementations§
Trait Implementations§
Source§impl Clock for ManualClock
impl Clock for ManualClock
Source§fn sleep(&self, seconds: f64)
fn sleep(&self, seconds: f64)
Blocks for the given number of seconds (no-op for
seconds <= 0).Source§fn sleep_async<'a>(
&'a self,
seconds: f64,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'a>>
fn sleep_async<'a>( &'a self, seconds: f64, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'a>>
Async sleep for the given number of seconds. For
SystemClock this awaits a real
timer; for ManualClock it advances logical time and returns immediately.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