#[async_trait]Expand description
The #[async_trait] macro is used to desugar async functions in traits
to return impl Future.
This macro is required mainly to get around the current limitation of
async functions in traits,
which would produce a lint warning for async_fn_in_trait if bare async
functions are defined in a trait.
§Example
Given the following trait definition:
ⓘ
#[async_trait]
pub trait CanRun {
async fn run(&self);
}The macro would desugar it to the following:
ⓘ
pub trait CanRun {
fn run(&self) -> impl Future<Output = ()>;
}