pub(crate) struct MockTimeCore {
instant: Instant,
wallclock: SystemTime,
coarse: MockCoarseTimeProvider,
}Expand description
Mock time, as (mostly) a value
Contains an Instant, SystemTime and CoarseTimeProvider.
Arranges that they are all moved in step, unless explicitly requested otherwise.
Fields§
§instant: InstantCurrent time (monotonic clock)
wallclock: SystemTimeCurrent wallclock time
coarse: MockCoarseTimeProviderCoarse time tracking
Implementations§
Source§impl MockTimeCore
impl MockTimeCore
Sourcepub(crate) fn wallclock(&self) -> SystemTime
pub(crate) fn wallclock(&self) -> SystemTime
Current wallclock time
Sourcepub(crate) fn coarse(&self) -> &MockCoarseTimeProvider
pub(crate) fn coarse(&self) -> &MockCoarseTimeProvider
Coarse time tracking
Source§impl MockTimeCore
impl MockTimeCore
Sourcepub(crate) fn new(instant: Instant, wallclock: SystemTime) -> Self
pub(crate) fn new(instant: Instant, wallclock: SystemTime) -> Self
Create a new MockTimeCore
Sourcepub(crate) fn advance(&mut self, d: Duration)
pub(crate) fn advance(&mut self, d: Duration)
Advance by a duration
All three time values are advanced in step.
Sourcepub(crate) fn jump_wallclock(&mut self, new_wallclock: SystemTime)
pub(crate) fn jump_wallclock(&mut self, new_wallclock: SystemTime)
Warp the wallclock (only)
Trait Implementations§
Source§impl AsMut<MockTimeCore> for State
impl AsMut<MockTimeCore> for State
Source§fn as_mut(&mut self) -> &mut MockTimeCore
fn as_mut(&mut self) -> &mut MockTimeCore
Converts this type into a mutable reference of the (usually inferred) input type.
Source§impl Clone for MockTimeCore
impl Clone for MockTimeCore
Source§fn clone(&self) -> MockTimeCore
fn clone(&self) -> MockTimeCore
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 moreAuto Trait Implementations§
impl Freeze for MockTimeCore
impl RefUnwindSafe for MockTimeCore
impl Send for MockTimeCore
impl Sync for MockTimeCore
impl Unpin for MockTimeCore
impl UnsafeUnpin for MockTimeCore
impl UnwindSafe for MockTimeCore
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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