2020-01-20 05:43:09 +01:00
|
|
|
use crate::Executor;
|
|
|
|
|
|
2020-01-20 10:39:17 +01:00
|
|
|
/// A type representing a `wasm-bindgen-futures` runtime.
|
2020-01-20 05:43:09 +01:00
|
|
|
#[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);
|
|
|
|
|
}
|
|
|
|
|
}
|