I'm trying to run basic reqwest
example :
(我正在尝试运行基本的reqwest
示例 :)
extern crate reqwest;
extern crate tokio;
#[tokio::main]
async fn main() -> Result<(), reqwest::Error> {
let res = reqwest::Client::new()
.get("https://hyper.rs")
.send()
.await?;
println!("Status: {}", res.status());
let body = res.text().await?;
println!("Body:
{}", body);
Ok(())
}
Error that I'm getting:
(我得到的错误:)
--> src/main.rs:6:15
|
6 | let res = reqwest::Client::new()
| _______________^
7 | | .get("https://hyper.rs")
8 | | .send()
9 | | .await?;
| |______________^ the trait `std::future::Future` is not implemented for `std::result::Result<reqwest::Response, reqwest::Error>`
Rust version: rustc 1.39.0 (4560ea788 2019-11-04)
(Rust版本: rustc 1.39.0 (4560ea788 2019-11-04)
)
Library versions:
(库版本:)
reqwest = "0.9.22"
tokio = { version = "0.2.0-alpha.6", features = ["full"] }
Does anybody know what is wrong here?
(有人知道这是怎么回事吗?)
ask by semanser translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…