Skip to main content

KernelClock

Trait KernelClock 

Source
pub trait KernelClock:
    Debug
    + Send
    + Sync {
    // Required methods
    fn now(&self) -> Result<ProtocolTimestamp, KernelError>;
    fn sleep_until(
        &self,
        deadline: ProtocolTimestamp,
    ) -> KernelDeadlineFuture<'_>;
}
Expand description

Replaceable source of canonical time and deterministic deadlines.

Required Methods§

Source

fn now(&self) -> Result<ProtocolTimestamp, KernelError>

Returns the current caller-visible protocol timestamp.

§Errors

Returns a typed error when the source cannot produce canonical time.

Source

fn sleep_until(&self, deadline: ProtocolTimestamp) -> KernelDeadlineFuture<'_>

Completes when the supplied canonical deadline is reached.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§