#[cfg(feature = "async")]
#[macro_export]
macro_rules! run_async {
($func:expr) => {{
#[cfg(all(feature = "async-tokio", feature = "async-wasm"))]
compile_error!("Do not enable both async-tokio and async-wasm features!");
#[cfg(all(feature = "async-tokio", feature = "async-wasi"))]
compile_error!("Do not enable both async-tokio and async-wasi features!");
#[cfg(all(feature = "async-wasm", feature = "async-wasi"))]
compile_error!("Do not enable both async-wasm and async-wasi features!");
#[cfg(not(any(
feature = "async-tokio",
feature = "async-wasm",
feature = "async-wasi"
)))]
compile_error!(
"No async runtime feature enabled! Enable one of: async-tokio, async-wasm, async-wasi"
);
#[cfg(feature = "async-tokio")]
{
let runtime = $crate::r#async::TokioHandle::current();
$func(&runtime).await
}
#[cfg(feature = "async-wasm")]
{
let runtime = $crate::r#async::WasmRuntime::new();
$func(&runtime).await
}
#[cfg(feature = "async-wasi")]
{
let runtime = $crate::r#async::WasiHandle::current();
$func(&runtime).await
}
}};
}