wasmer_wasix::runtime::task_manager

Trait VirtualTaskManagerExt

Source
pub trait VirtualTaskManagerExt {
    // Required methods
    fn spawn_and_block_on<A>(
        &self,
        task: impl Future<Output = A> + Send + 'static,
    ) -> Result<A, Error>
       where A: Send + 'static;
    fn spawn_await<O, F>(
        &self,
        f: F,
    ) -> Box<dyn Future<Output = Result<O, Box<dyn Error>>> + Unpin + Send + 'static>
       where O: Send + 'static,
             F: FnOnce() -> O + Send + 'static;
}
Expand description

Generic utility methods for VirtualTaskManager

Required Methods§

Source

fn spawn_and_block_on<A>( &self, task: impl Future<Output = A> + Send + 'static, ) -> Result<A, Error>
where A: Send + 'static,

Runs the work in the background via the task managers shared background threads while blocking the current execution until it finishs

Source

fn spawn_await<O, F>( &self, f: F, ) -> Box<dyn Future<Output = Result<O, Box<dyn Error>>> + Unpin + Send + 'static>
where O: Send + 'static, F: FnOnce() -> O + Send + 'static,

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.

Implementors§

Source§

impl<D, T> VirtualTaskManagerExt for D
where D: Deref<Target = T>, T: VirtualTaskManager + ?Sized,