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 moreAuto Trait Implementations§
impl !RefUnwindSafe for MockableClock
impl Send for MockableClock
impl Sync for MockableClock
impl Unpin for MockableClock
impl !UnwindSafe for MockableClock
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