mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-07-31 17:01:58 +00:00
feat(swarm): Add wasm-bindgen
executor (#3115)
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user