pub struct ManualClock { /* private fields */ }Expand description
A clock that only moves when a test moves it.
use chrono::{TimeDelta, Utc};
use turnframe_store::memory::{Clock, ManualClock};
let clock = ManualClock::new(Utc::now());
let start = clock.now();
clock.advance(TimeDelta::seconds(30));
assert_eq!(clock.now(), start + TimeDelta::seconds(30));Implementations§
Source§impl ManualClock
impl ManualClock
Sourcepub fn new(start: DateTime<Utc>) -> ManualClock
pub fn new(start: DateTime<Utc>) -> ManualClock
A clock stopped at start.
Sourcepub fn epoch() -> ManualClock
pub fn epoch() -> ManualClock
A clock stopped at the Unix epoch, for tests that only care about order.
Trait Implementations§
Source§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