Crate async_attributes
source ·Expand description
Experimental language-level polyfills for Async Rust.
Examples
#[async_attributes::main]
async fn main() {
println!("Hello, world!");
}
About
Async Rust is a work in progress. The language has enabled us to do some fantastic things, but not everything is figured out yet. This crate exists to polyfill language-level support for async idioms before they can be part of the language.
A great example of this is async fn main
, which we first introduced as
part of the runtime
crate.
Its premise is that if async fn
is required for every await
call, it
makes sense to apply that even to fn main
. Unfortunately this would
require compiler support to enable, so we’ve provided an experimental
polyfill for it in the mean time.
Attribute Macros
- Enables an async benchmark function.
- Enables an async main function.
- Enables an async test function.