summaryrefslogtreecommitdiffstats
path: root/futures/src/executor/wasm_bindgen.rs
blob: 2a12a1c0cddac1d2bc10f6bc608a89e0279cd706 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use crate::Executor;

/// A type representing 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);
    }
}