Skip to main content

ankurah_core/
task.rs

1use std::future::Future;
2
3#[cfg(not(target_arch = "wasm32"))]
4/// Spawn a task
5pub fn spawn<F>(future: F)
6where
7    F: Future + Send + 'static,
8    <F as futures::Future>::Output: std::marker::Send,
9{
10    tokio::spawn(future);
11}
12
13#[cfg(target_arch = "wasm32")]
14pub fn spawn<F>(future: F)
15where F: Future<Output = ()> + Send + 'static {
16    wasm_bindgen_futures::spawn_local(future);
17}