Skip to main content

StdMonotonicClock

Struct StdMonotonicClock 

Source
pub struct StdMonotonicClock { /* private fields */ }
Expand description

A real monotonic clock backed by std::time::Instant.

The type intentionally does not implement Clone. Shared identity is expressed explicitly with Arc<StdMonotonicClock>.

Implementations§

Source§

impl StdMonotonicClock

Source

pub fn new() -> Self

Creates a new independent clock domain at the current native instant.

§Returns

A standard monotonic clock with a newly allocated domain.

§Panics

Panics if all process-wide clock-domain identifiers are exhausted.

Trait Implementations§

Source§

impl Debug for StdMonotonicClock

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for StdMonotonicClock

Source§

fn default() -> Self

Creates a new independent standard monotonic clock domain.

§Returns

A standard monotonic clock with a newly allocated domain.

§Panics

Panics if all process-wide clock-domain identifiers are exhausted.

Source§

impl MonotonicClock for StdMonotonicClock

Source§

fn domain(&self) -> ClockDomain

Returns this clock’s stable monotonic domain identity.

§Returns

This clock’s process-unique domain.

Source§

fn now(&self) -> MonotonicInstant

Returns the current instant in this clock’s domain.

§Returns

The current elapsed duration represented in this clock’s domain.

Source§

fn new_timer(&self) -> Arc<dyn Timer>

Creates a timer retaining this exact standard clock domain and origin.

§Returns

A shared timer backed by one lazy standard scheduler worker.

Source§

fn deadline_after( &self, duration: Duration, ) -> Result<MonotonicInstant, TimeError>

Fixes a deadline after a relative duration. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.