Can't Compile Simple Async Reqwest Example


I'm trying to run the example of reqwest, but I can't get it to compile I've tried both stable and nightly.
I get the following error message when I cargo run:

error[E0277]: the trait bound `std::result::Result<reqwest::response::Response, reqwest::error::Error>: std::future::Future` is not satisfied
  --> src/
8  |     let res = reqwest::get("").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`.

Here's the Cargo.toml I'm using:

name = "test_reqwest"
version = "0.1.0"
authors = ["ambiso <ambiso@invalid>"]
edition = "2018"

# See more keys and their definitions at

tokio = { version = "0.2", features = ["macros"] }
reqwest = "*"

And my

use tokio;
use reqwest;
use std::collections::HashMap;
use std::future::Future;

async fn main() -> Result<(), reqwest::Error> {
    let res = reqwest::get("").await?;

    println!("Status: {}", res.status());

    let body = res.text().await?;

    println!("Body:\n\n{}", body);


Am I doing something wrong? Or has the library not yet kept up with the async change?
Thanks for any help!


What you want is reqwest version 0.10.0-alpha.2 and you won't get alpha versions by using star in the version field.

Thank you!!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.