wasm_bindgen_futures/
lib.rs1#![cfg_attr(not(feature = "std"), no_std)]
13
14pub use js_sys::futures::{future_to_promise, future_to_promise_typed, spawn_local, JsFuture};
15
16#[cfg(feature = "futures-core-03-stream")]
17pub use js_sys::futures::stream;
18
19#[cfg(not(target_feature = "atomics"))]
20#[allow(deprecated)]
21pub use js_sys::futures::jspi_block_on_promise;
22
23#[cfg(all(target_os = "emscripten", wasm_bindgen_unstable_tokio))]
24pub mod tokio;
25
26#[cfg(not(all(target_os = "emscripten", wasm_bindgen_unstable_tokio)))]
30#[doc(hidden)]
31pub mod tokio {
32 #[diagnostic::on_unimplemented(
33 message = "`#[wasm_bindgen(experimental_tokio)]` is only supported on the \
34 `wasm32-unknown-emscripten` target with `--cfg wasm_bindgen_unstable_tokio`",
35 label = "this async export is driven on a tokio event loop"
36 )]
37 pub trait ExperimentalTokioSupported {}
38
39 pub fn schedule<F: ExperimentalTokioSupported, C>(_future: F, _on_complete: C) {
40 unreachable!()
41 }
42
43 pub fn schedule_isolated<F: ExperimentalTokioSupported, C>(_future: F, _on_complete: C) {
44 unreachable!()
45 }
46
47 pub fn block_on<F: ExperimentalTokioSupported + core::future::Future>(_future: F) -> F::Output {
48 unreachable!()
49 }
50
51 pub fn block_on_isolated<F: ExperimentalTokioSupported + core::future::Future>(
52 _future: F,
53 ) -> F::Output {
54 unreachable!()
55 }
56}
57
58pub use js_sys;
59pub use wasm_bindgen;