我想使用reqwest
条板箱发出异步HTTP请求。我有以下代码:
$ docker run --rm -it --shm-size=1G alpine sh -c 'mount | grep shm'
shm on /dev/shm type tmpfs (rw,seclabel,nosuid,nodev,noexec,relatime,size=1048576k)`
当我尝试编译代码时,出现以下错误:
// 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
模块导入?
答案 0 :(得分:5)
由于reqwest::async
在async
是保留关键字(我相信在Rust 2018中发生)之前是在Just Justed™之前创建的。
现在async
是保留关键字,您需要使用raw identifier语法:
use request::r#async::Client;