#[cfg(feature = "async")]
#[macro_export]
macro_rules! feagi_main {
($app_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")]
#[tokio::main]
async fn main() {
$crate::async::run_async!($app_func);
}
#[cfg(feature = "async-wasm")]
#[wasm_bindgen::prelude::wasm_bindgen(start)]
pub fn main() {
wasm_bindgen_futures::spawn_local(async {
$crate::run_async!($app_func);
});
}
#[cfg(feature = "async-wasi")]
fn main() {
compile_error!("WASI main entry not yet implemented");
}
};
}