pub trait Host: 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".
Implementations on Foreign Types§
Source§impl<_T: Host + ?Sized + Send> Host for &mut _T
impl<_T: Host + ?Sized + Send> Host for &mut _T
Source§fn 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.
Source§fn 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.