pub struct Clock<T> { /* private fields */ }Expand description
A generic structure that represents a clock.
It can be either the working clock (production) or the stopped clock
(testing). It implements the Time trait, which gives you the current time.
Trait Implementations§
source§impl Make<Clock<StoppedClock>> for StoppedTimeExtentMaker
impl Make<Clock<StoppedClock>> for StoppedTimeExtentMaker
source§fn now(increment: &Base) -> Option<Result<TimeExtent, TryFromIntError>>
fn now(increment: &Base) -> Option<Result<TimeExtent, TryFromIntError>>
It gives you the current time extent (with a certain increment) for
the current time. It gets the current timestamp front the
Clock. Read moresource§fn now_after(
increment: &Base,
add_time: &Duration,
) -> Option<Result<TimeExtent, TryFromIntError>>
fn now_after( increment: &Base, add_time: &Duration, ) -> Option<Result<TimeExtent, TryFromIntError>>
Same as
now, but it
will add an extra duration to the current time before calculating the
time extent. It gives you a time extent for a time in the future.source§fn now_before(
increment: &Base,
sub_time: &Duration,
) -> Option<Result<TimeExtent, TryFromIntError>>
fn now_before( increment: &Base, sub_time: &Duration, ) -> Option<Result<TimeExtent, TryFromIntError>>
Same as
now, but it
will subtract a duration to the current time before calculating the
time extent. It gives you a time extent for a time in the past.source§impl Make<Clock<WorkingClock>> for WorkingTimeExtentMaker
impl Make<Clock<WorkingClock>> for WorkingTimeExtentMaker
source§fn now(increment: &Base) -> Option<Result<TimeExtent, TryFromIntError>>
fn now(increment: &Base) -> Option<Result<TimeExtent, TryFromIntError>>
It gives you the current time extent (with a certain increment) for
the current time. It gets the current timestamp front the
Clock. Read moresource§fn now_after(
increment: &Base,
add_time: &Duration,
) -> Option<Result<TimeExtent, TryFromIntError>>
fn now_after( increment: &Base, add_time: &Duration, ) -> Option<Result<TimeExtent, TryFromIntError>>
Same as
now, but it
will add an extra duration to the current time before calculating the
time extent. It gives you a time extent for a time in the future.source§fn now_before(
increment: &Base,
sub_time: &Duration,
) -> Option<Result<TimeExtent, TryFromIntError>>
fn now_before( increment: &Base, sub_time: &Duration, ) -> Option<Result<TimeExtent, TryFromIntError>>
Same as
now, but it
will subtract a duration to the current time before calculating the
time extent. It gives you a time extent for a time in the past.Auto Trait Implementations§
impl<T> Freeze for Clock<T>
impl<T> RefUnwindSafe for Clock<T>where
T: RefUnwindSafe,
impl<T> Send for Clock<T>where
T: Send,
impl<T> Sync for Clock<T>where
T: Sync,
impl<T> Unpin for Clock<T>where
T: Unpin,
impl<T> UnwindSafe for Clock<T>where
T: UnwindSafe,
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> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more