actix/actix-protobuf

no method named `map_err` found for type `ProtoBufMessage<actix_web::HttpRequest<S>, _>` in the current scope

peitalin opened this issue · 2 comments

Hi,

I'm trying to get this example working for actix_web 0.7 but am running into a puzzling error:

error[E0599]: no method named `map_err` found for type `ProtoBufMessage<actix_web::HttpRequest<S>, _>` in the current scope
   --> actix-protobuf/src/lib.rs:103:14
    |
103 |               .map_err()
    |                ^^^^^^^
...
111 | / pub struct ProtoBufMessage<T, U>
112 | | where U: Message + Default,
113 | | {
114 | |     limit: usize,
...   |
117 | |     fut: Option<Box<Future<Item=U, Error=ProtoBufPayloadError>>>,
118 | | }
    | |_- method `map_err` not found for this
    |
    = note: the method `map_err` exists but the following trait bounds were not satisfied:
            `ProtoBufMessage<actix_web::HttpRequest<S>, _> : futures::Future`
            `&mut ProtoBufMessage<actix_web::HttpRequest<S>, _> : futures::Future`
            `&mut ProtoBufMessage<actix_web::HttpRequest<S>, _> : futures::Stream`
    = help: items from traits can only be used if the trait is implemented and in scope
    = note: the following traits define an item `map_err`, perhaps you need to implement one of them:
            candidate #1: `actix::ActorFuture`
            candidate #2: `actix::ActorStream`
            candidate #3: `futures::Future`
            candidate #4: `futures::Stream`
            candidate #5: `actix_net::service::ServiceExt`
            candidate #6: `actix_net::service::NewServiceExt`

What's confusing is that there is already an implementation for futures::Future so I'm not so why this error persists:

actix-protobuf/src/lib.rs

Lines 186 to 187 in 99e4e1c

impl<T, U: Message + Default + 'static> Future for ProtoBufMessage<T, U>
where T: HttpMessage + Stream<Item=Bytes, Error=PayloadError> + 'static

Any ideas on what may be the cause?

Please upgrade to new version 0.3.0.

actix-protobuf = { git="https://github.com/actix/actix-protobuf"}

It's working great now, thank you @kingxsp.