pub struct ManualClock { /* private fields */ }Expand description
Clock whose value is set explicitly. Intended for tests; carrying it in
release builds costs only the size of the type itself, and it lets
integration tests outside src/ reach ManualClock without juggling
feature flags.
Use ManualClock::new to start at a specific epoch, then ManualClock::set
or ManualClock::tick to advance time deterministically inside tests.
Implementations§
Source§impl ManualClock
impl ManualClock
Trait Implementations§
Source§impl Clock for ManualClock
impl Clock for ManualClock
Source§fn now_unix_secs(&self) -> u64
fn now_unix_secs(&self) -> u64
Whole seconds since the Unix epoch.
Source§fn now_unix_secs_f64(&self) -> f64
fn now_unix_secs_f64(&self) -> f64
Fractional seconds since the Unix epoch, retaining sub-second precision
for callers that need it (e.g.,
cached_at in import flows that route
through stream events).Source§impl Clone for ManualClock
impl Clone for ManualClock
Source§fn clone(&self) -> ManualClock
fn clone(&self) -> ManualClock
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ManualClock
impl Debug for ManualClock
Source§impl Default for ManualClock
impl Default for ManualClock
Source§fn default() -> ManualClock
fn default() -> ManualClock
Returns the “default value” for a type. Read more
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