1use std::future::Future;
2
3#[cfg(any(not(target_arch = "wasm32"), target_os = "wasi"))]
9pub fn spawn<F: Future<Output = ()> + Send + 'static>(f: F) {
10 #[cfg(feature = "tracing")]
11 let f = tracing::Instrument::in_current_span(f);
12 tokio::task::spawn(f);
13}
14
15#[cfg(all(target_arch = "wasm32", not(target_os = "wasi")))]
16pub fn spawn<F: Future<Output = ()> + 'static>(f: F) {
17 #[cfg(feature = "tracing")]
18 let f = tracing::Instrument::in_current_span(f);
19 wasm_bindgen_futures::spawn_local(f);
20}