I want to make asynchronous HTTP requests using the reqwest
crate. I have the following code:
// see https://docs.rs/reqwest/*/reqwest/async/index.html
use reqwest::async::Client;
When I attempt to compile my code I get the following error:
error: expected identifier, found reserved keyword `async`
--> src/main.rs:1:14
|
1 | use reqwest::async::Client;
| ^^^^^ expected identifier, found reserved keyword
How do I import from the async
module?
Since reqwest::async
was created before async
was a reserved keyword (which happened in Rust 2018, I believe) previously this Just Worked™.
Now that async
is a reserved keyword you need to use the raw identifier syntax:
use request::r#async::Client;