pub trait Host: Send + Send {
// Required methods
fn now(&mut self) -> impl Future<Output = Result<Instant>> + Send;
fn resolution(&mut self) -> impl Future<Output = Result<Duration>> + Send;
fn subscribe_instant(
&mut self,
when: Instant,
) -> impl Future<Output = Result<Resource<Pollable>>> + Send;
fn subscribe_duration(
&mut self,
when: Duration,
) -> impl Future<Output = Result<Resource<Pollable>>> + Send;
}
Required Methods§
Sourcefn now(&mut self) -> impl Future<Output = Result<Instant>> + Send
fn now(&mut self) -> impl Future<Output = Result<Instant>> + Send
Read the current value of the clock.
The clock is monotonic, therefore calling this function repeatedly will produce a sequence of non-decreasing values.
Sourcefn resolution(&mut self) -> impl Future<Output = Result<Duration>> + Send
fn resolution(&mut self) -> impl Future<Output = Result<Duration>> + Send
Query the resolution of the clock. Returns the duration of time corresponding to a clock tick.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementations on Foreign Types§
Source§impl<_T: Host + ?Sized + Send> Host for &mut _T
impl<_T: Host + ?Sized + Send> Host for &mut _T
Source§async fn now(&mut self) -> Result<Instant>
async fn now(&mut self) -> Result<Instant>
Read the current value of the clock.
The clock is monotonic, therefore calling this function repeatedly will produce a sequence of non-decreasing values.
Source§async fn resolution(&mut self) -> Result<Duration>
async fn resolution(&mut self) -> Result<Duration>
Query the resolution of the clock. Returns the duration of time corresponding to a clock tick.