Sha256: 50a1fe0c52130894e4bfcf908c8a8712bf12b6c2d8befedd728b30f9ce1f8c92
Contents?: true
Size: 791 Bytes
Versions: 15
Compression:
Stored size: 791 Bytes
Contents
#[cfg(unix)] mod unix; #[cfg(unix)] pub use unix::poll_oneoff; #[cfg(windows)] mod windows; #[cfg(windows)] pub use windows::poll_oneoff; use crate::{ sched::{Duration, Poll, WasiSched}, Error, }; pub fn sched_ctx() -> Box<dyn crate::WasiSched> { struct AsyncSched; #[wiggle::async_trait] impl WasiSched for AsyncSched { async fn poll_oneoff<'a>(&self, poll: &mut Poll<'a>) -> Result<(), Error> { poll_oneoff(poll).await } async fn sched_yield(&self) -> Result<(), Error> { tokio::task::yield_now().await; Ok(()) } async fn sleep(&self, duration: Duration) -> Result<(), Error> { tokio::time::sleep(duration).await; Ok(()) } } Box::new(AsyncSched) }
Version data entries
15 entries across 15 versions & 1 rubygems