pub trait Host: Send {
    // Required methods
    fn now(&mut self) -> Result<u64, Error>;
    fn resolution(&mut self) -> Result<u64, Error>;
    fn subscribe_instant(
        &mut self,
        when: u64,
    ) -> Result<Resource<Pollable>, Error>;
    fn subscribe_duration(
        &mut self,
        when: u64,
    ) -> Result<Resource<Pollable>, Error>;
}

Required Methods§

source

fn now(&mut self) -> Result<u64, Error>

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) -> Result<u64, Error>

Query the resolution of the clock. Returns the duration of time corresponding to a clock tick.

source

fn subscribe_instant(&mut self, when: u64) -> Result<Resource<Pollable>, Error>

Create a pollable which will resolve once the specified instant has occurred.

source

fn subscribe_duration(&mut self, when: u64) -> Result<Resource<Pollable>, Error>

Create a pollable that will resolve after the specified duration has elapsed from the time this function is invoked.

Implementations on Foreign Types§

source§

impl<_T> Host for &mut _T
where _T: Host + Send + ?Sized,

source§

fn now(&mut self) -> Result<u64, Error>

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) -> Result<u64, Error>

Query the resolution of the clock. Returns the duration of time corresponding to a clock tick.

source§

fn subscribe_instant(&mut self, when: u64) -> Result<Resource<Pollable>, Error>

Create a pollable which will resolve once the specified instant has occurred.

source§

fn subscribe_duration(&mut self, when: u64) -> Result<Resource<Pollable>, Error>

Create a pollable that will resolve after the specified duration has elapsed from the time this function is invoked.

Implementors§

source§

impl<T> Host for WasiImpl<T>
where T: WasiView,