diff options
Diffstat (limited to 'futures/src/executor/wasm_bindgen.rs')
-rw-r--r-- | futures/src/executor/wasm_bindgen.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/futures/src/executor/wasm_bindgen.rs b/futures/src/executor/wasm_bindgen.rs new file mode 100644 index 00000000..69b7c7e2 --- /dev/null +++ b/futures/src/executor/wasm_bindgen.rs @@ -0,0 +1,18 @@ +use crate::Executor; + +/// A `wasm-bindgen-futures` runtime. +#[derive(Debug)] +pub struct WasmBindgen; + +impl Executor for WasmBindgen { + fn new() -> Result<Self, futures::io::Error> { + Ok(Self) + } + + fn spawn( + &self, + future: impl futures::Future<Output = ()> + Send + 'static, + ) { + wasm_bindgen_futures::spawn_local(future); + } +} |