Skip to main content

Clock

Trait Clock 

Source
pub trait Clock:
    Send
    + Sync
    + 'static {
    // Required methods
    fn now(&self) -> Instant;
    fn sleep(
        &self,
        duration: Duration,
    ) -> Pin<Box<dyn Future<Output = Instant> + Send + 'static>>;
}
Expand description

The source of time shared by delayed effects and interval subscriptions.

Required Methods§

Source

fn now(&self) -> Instant

Returns the clock’s current monotonic instant.

Source

fn sleep( &self, duration: Duration, ) -> Pin<Box<dyn Future<Output = Instant> + Send + 'static>>

Waits for duration and returns the firing instant.

Implementations on Foreign Types§

Source§

impl<C> Clock for Arc<C>
where C: Clock + ?Sized,

Source§

fn now(&self) -> Instant

Source§

fn sleep( &self, duration: Duration, ) -> Pin<Box<dyn Future<Output = Instant> + Send + 'static>>

Implementors§