Skip to main content

pink_sidevm/
exec.rs

1//! Executors to bridge frameworks to sidevm.
2
3/// A hyper executor that executes futures with sidevm::spawn.
4#[cfg(feature = "hyper")]
5#[derive(Clone, Copy, Debug)]
6pub struct HyperExecutor;
7
8#[cfg(feature = "hyper")]
9impl<F> hyper::rt::Executor<F> for HyperExecutor
10where
11    F: std::future::Future + 'static,
12{
13    fn execute(&self, fut: F) {
14        crate::spawn(fut);
15    }
16}