1
0
mirror of https://github.com/fluencelabs/rust-libp2p synced 2025-07-31 17:01:58 +00:00

feat(swarm): Add wasm-bindgen executor ()

This commit is contained in:
Hannes
2022-11-24 23:12:35 +01:00
committed by GitHub
parent 98336b7885
commit cff84f1897
4 changed files with 38 additions and 1 deletions

@@ -59,3 +59,14 @@ impl Executor for AsyncStdExecutor {
let _ = async_std::task::spawn(future);
}
}
#[cfg(feature = "wasm-bindgen")]
#[derive(Default, Debug, Clone, Copy, Hash, PartialEq, Eq, PartialOrd, Ord)]
pub struct WasmBindgenExecutor;
#[cfg(feature = "wasm-bindgen")]
impl Executor for WasmBindgenExecutor {
fn exec(&self, future: Pin<Box<dyn Future<Output = ()> + Send>>) {
wasm_bindgen_futures::spawn_local(future)
}
}