Async fn in trait MVP comes to nightly:
The async working group is excited to announce that
async fn
can now be used in traits in the nightly compiler. You can now write code like this:#![feature(async_fn_in_trait)] trait Database { async fn fetch_data(&self) -> String; } impl Database for MyDb { async fn fetch_data(&self) -> String { ... } }
A full working example is available in the playground. There are some limitations we’ll cover, as well as a few known bugs to be worked out, but we think it is ready for some users try. Read on for the specifics.
[—]
Source: Inside Rust Blog