Closed
Description
use async_std::prelude::*;
use async_std::task::block_on;
use reqwest::Client;
async fn run() -> Result<(),()> {
let mut url = "";
let res = Client::new().get(url).send().await?;
let result = res.to_string();
Ok(())
}
fn main(){
block_on(run());
}
error[E0277]: the trait bound `std::result::Result<reqwest::response::Response, reqwest::error::Error>: std::future::Future` is not satisfied
--> src/main.rs:11:15
|
11 | let res = Client::new().get(url).send().await?;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::future::Future` is not implemented for `std::result::Result<reqwest::response::Response, reqwest::error::Error>`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0277`.
what the heck is this error? async function should be return Future of Output = std::result::Result<reqwest::response::Response, reqwest::error::Error>
, why don't satisfy?How could I solve this?
Metadata
Metadata
Assignees
Labels
No labels