pub struct SimClock;
Expand description
Clock to be used in simulator runs that allows the simnet to create a scheduled event for. When the wakeup event becomes the next earliest scheduled event, the simnet will advance it’s time to the wakeup time and use the transmitter to wake up this green thread
Implementations§
Source§impl SimClock
impl SimClock
Sourcepub fn advance_to(&self, time: Instant)
pub fn advance_to(&self, time: Instant)
Advance the sumulator’s time to the specified instant
Sourcepub fn duration_since_start(&self, instant: Instant) -> Duration
pub fn duration_since_start(&self, instant: Instant) -> Duration
Get the number of milliseconds elapsed since the start of the simulation
Trait Implementations§
Source§impl Clock for SimClock
impl Clock for SimClock
Source§async fn sleep(&self, duration: Duration)
async fn sleep(&self, duration: Duration)
Tell the simnet to wake up this green thread after the specified duration has pass on the simnet
Source§async fn non_advancing_sleep(&self, duration: Duration)
async fn non_advancing_sleep(&self, duration: Duration)
Initiates a sleep for the specified duration
Source§async fn sleep_until(&self, deadline: Instant)
async fn sleep_until(&self, deadline: Instant)
Sleep until the specified deadline.
Source§fn system_time_now(&self) -> SystemTime
fn system_time_now(&self) -> SystemTime
Get the current system time according to the clock
Source§impl<'de> Deserialize<'de> for SimClock
impl<'de> Deserialize<'de> for SimClock
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for SimClock
impl RefUnwindSafe for SimClock
impl Send for SimClock
impl Sync for SimClock
impl Unpin for SimClock
impl UnwindSafe for SimClock
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,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<A, M> Handler<IndexedErasedUnbound<M>> for A
impl<A, M> Handler<IndexedErasedUnbound<M>> for A
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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