use std::future::Future;
#[inline]
pub fn block_on<F>(future: F) -> F::Output
where
F: Future,
{
pollster::block_on(future)
}
#[cfg(target_arch = "wasm32")]
#[inline]
pub fn spawn_local<F>(future: F)
where
F: Future<Output = ()> + 'static,
{
wasm_bindgen_futures::spawn_local(future);
}
#[cfg(not(target_arch = "wasm32"))]
#[inline]
pub fn spawn_local<F>(future: F)
where
F: Future<Output = ()> + 'static,
{
// Native platforms can synchronously block on the task without impacting the
// single-threaded environments that wasm targets run in.
block_on(future);
}