Skip to content

trait bound not satified #580

Closed
Closed
@CGQAQ

Description

@CGQAQ
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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions