pub enum MockableClock {
Real,
Mock(Arc<TimerRegistry>),
}
Variants§
Real
Mock(Arc<TimerRegistry>)
Implementations§
source§impl MockableClock
impl MockableClock
pub fn mock() -> (Self, Arc<TimerRegistry>)
pub fn now(&self) -> Instant
pub async fn sleep(&self, duration: Duration) -> TimeHandlerGuard
pub fn interval(&self, period: Duration) -> Interval
pub async fn timeout<F, T>(
&self,
duration: Duration,
future: F
) -> Result<T, TimeoutError>where
F: Future<Output = T>,
Trait Implementations§
source§impl Clone for MockableClock
impl Clone for MockableClock
source§fn clone(&self) -> MockableClock
fn clone(&self) -> MockableClock
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read more