1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
use super::{SpawnJoinHandle, Spawning};
#[cfg(not(feature = "log"))]
use crate::log;
use core::future::Future as CoreFuture;
use core::future::{ready, Ready};
pub struct Runtime;
impl SpawnJoinHandle<()> for Ready<()> {}
impl Spawning<(), Ready<()>, ()> for Runtime {
fn spawn<F>(_: F) -> Ready<()>
where
F: CoreFuture<Output = ()> + Send + 'static,
{
unimplemented!("Wasm runtime only provides spawn_local for execution")
}
fn spawn_blocking<F>(_: F) -> Ready<()>
where
F: FnOnce() -> () + Send + 'static,
{
unimplemented!("Wasm runtime only provides spawn_local for execution")
}
fn block_on<F>(_: F)
where
F: CoreFuture<Output = ()>,
{
unimplemented!("Wasm runtime only provides spawn_local for execution")
}
fn spawn_local<F>(fut: F) -> Ready<()>
where
F: CoreFuture<Output = ()> + 'static,
{
log::debug!("Spawn local future");
wasm_bindgen_futures::spawn_local(fut);
ready(())
}
}