pub struct Time<'a, R: Runtime> { /* private fields */ }Expand description
Time utilities accessor for RuntimeContext
Provides duration creation, sleep, and timing measurements.
Implementations§
Source§impl<'a, R: Runtime> Time<'a, R>
impl<'a, R: Runtime> Time<'a, R>
Sourcepub fn sleep(
&self,
duration: R::Duration,
) -> impl Future<Output = ()> + Send + '_
pub fn sleep( &self, duration: R::Duration, ) -> impl Future<Output = ()> + Send + '_
Sleep for the specified duration
Sourcepub fn duration_since(
&self,
later: R::Instant,
earlier: R::Instant,
) -> Option<R::Duration>
pub fn duration_since( &self, later: R::Instant, earlier: R::Instant, ) -> Option<R::Duration>
Get the duration between two instants
Returns None if later is before earlier.
Sourcepub fn duration_as_nanos(&self, duration: R::Duration) -> u64
pub fn duration_as_nanos(&self, duration: R::Duration) -> u64
Number of whole nanoseconds in a duration (runtime-agnostic).
Auto Trait Implementations§
impl<'a, R> Freeze for Time<'a, R>
impl<'a, R> RefUnwindSafe for Time<'a, R>where
R: RefUnwindSafe,
impl<'a, R> Send for Time<'a, R>
impl<'a, R> Sync for Time<'a, R>
impl<'a, R> Unpin for Time<'a, R>
impl<'a, R> UnsafeUnpin for Time<'a, R>
impl<'a, R> UnwindSafe for Time<'a, R>where
R: RefUnwindSafe,
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