Skip to main content

ManualTimer

Struct ManualTimer 

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

An asynchronous timer driven by one manual monotonic time domain.

Registrations are visible through the source clock’s coordination APIs before this timer returns their futures. The timer and its futures retain a private same-domain clock handle, so they remain valid if the source clock value is dropped.

Implementations§

Source§

impl ManualTimer

Source

pub fn from_clock(clock: &ManualMonotonicClock) -> Self

Creates a timer sharing the supplied manual clock’s exact time domain.

§Parameters
  • clock - Manual clock whose domain and timeline drive this timer.
§Returns

An independent timer handle retaining the same manual time domain.

Trait Implementations§

Source§

impl Debug for ManualTimer

Source§

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

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

impl Timer for ManualTimer

Source§

fn clock(&self) -> &dyn MonotonicClock

Returns the private same-domain manual clock handle.

§Returns

The monotonic clock driving this timer.

Source§

fn at(&self, deadline: MonotonicInstant) -> Result<TimerFuture, TimeError>

Eagerly registers an absolute deadline with the manual clock.

§Parameters
  • deadline - Deadline in this timer’s manual clock domain.
§Returns

A cancellation-safe future whose registration is already active.

§Errors

Returns TimeError::ClockDomainMismatch for a foreign deadline.

§Panics

Panics when waiter identifiers are exhausted or when a reached observer waker panics during registration notification.

Source§

fn now(&self) -> MonotonicInstant

Returns the current monotonic instant in this timer’s clock domain. Read more
Source§

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

Fixes an absolute deadline relative to the current timer instant. Read more
Source§

fn after(&self, duration: Duration) -> Result<TimerFuture, TimeError>

Registers a notification 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 = Infallible

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.