Actix-web: no method named `from_err` found for type `actix_web::dev::MessageBody<actix_web::HttpRequest>`

Created on 26 Jun 2018  路  3Comments  路  Source: actix/actix-web

I'm trying compile https://github.com/actix/examples/blob/master/http-proxy/src/server.rs but i got below error.

error[E0599]: no method named `from_err` found for type `actix_web::dev::MessageBody<actix_web::HttpRequest>` in the current scope
  --> src/main.rs:16:10
   |
16 |         .from_err()
   |          ^^^^^^^^
   |
   = help: items from traits can only be used if the trait is in scope
help: the following trait is implemented but not in scope, perhaps add a `use` for it:
   |
9  | use futures::future::Future;
   |

error: aborting due to previous error

For more information about this error, try `rustc --explain E0599`.
error: Could not compile `Account`.

It's about this section :

fn api(req: actix_web::HttpRequest) -> Result<actix_web::HttpResponse, actix_web::Error> {
    req.body()
        .from_err()
        .map(|bytes| actix_web::HttpResponse::Ok().body(bytes))
        .responder()
}

Most helpful comment

@uncotion do you use futures 0.1?

All 3 comments

Just to be sure you compiled example as it is without any modifications?

It is just strange since compiler for some reason says you need to use futures::Future

@uncotion do you use futures 0.1?

It was about futures 0.2.
thanks.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

alex picture alex  路  4Comments

zhaobingss picture zhaobingss  路  4Comments

cheolgyu picture cheolgyu  路  3Comments

joshsleeper picture joshsleeper  路  3Comments

fafhrd91 picture fafhrd91  路  5Comments