moirai-async-macros
The #[main] attribute macro for the
Moirai async runtime.
Rust's entry point cannot itself be async, so something has to build a runtime
and block on the future. This crate is that shim, keeping executor construction
out of user code: the annotated function is rewritten into a synchronous main
that builds an AsyncExecutor with its defaults and blocks on the original
body, preserving the function's attributes and visibility.
The macro is re-exported by
moirai-async; depend on that crate
rather than on this one directly.
[]
= "0.5"
async
The attribute takes no arguments. A caller needing a configured executor should
build one directly and call block_on instead. The generated main panics if
the executor cannot be created — it runs before any user code, so there is no
state to unwind.
Full documentation: https://docs.rs/moirai-async-macros
License
Licensed under either of Apache-2.0 or MIT at your option.