pub struct MockTime { /* private fields */ }Expand description
Virtual time utilities for testing timeouts and delays.
This module provides helpers for simulating time passage in tests without waiting for actual wall-clock time.
§Example
ⓘ
use fastapi_core::testing::MockTime;
let mock_time = MockTime::new();
// Advance virtual time by 5 seconds
mock_time.advance(Duration::from_secs(5));
// Check that timer would have expired
assert!(mock_time.elapsed() >= Duration::from_secs(5));Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MockTime
impl RefUnwindSafe for MockTime
impl Send for MockTime
impl Sync for MockTime
impl Unpin for MockTime
impl UnwindSafe for MockTime
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, _span: NoopSpan) -> Self
fn instrument(self, _span: NoopSpan) -> Self
Instruments this future with a span (no-op when disabled).
Source§fn in_current_span(self) -> Self
fn in_current_span(self) -> Self
Instruments this future with the current span (no-op when disabled).