我想使用reqwest
包进行异步HTTP请求。我有以下代码:
// see https://docs.rs/reqwest/*/reqwest/async/index.html
use reqwest::async::Client;
当我尝试编译我的代码时,我收到以下错误:
error: expected identifier, found reserved keyword `async`
--> src/main.rs:1:14
|
1 | use reqwest::async::Client;
| ^^^^^ expected identifier, found reserved keyword
如何从async
模块导入?
由于reqwest::async
创建之前async
是一个保留关键字(发生在Rust 2018,我相信)以前这个Just Worked™。
既然async
是保留关键字,您需要使用raw identifier语法:
use request::r#async::Client;