I've run into another issue while converting to Futures. I'm getting a conflict in types, possibly because of mixed usage of Streams and Futures, but I'm not sure.
https://github.com/bluejekyll/trust-dns/blob/bfry/futures/src/client/client_future.rs#L48
Is causing this error in nightly (I switched from stable for the excellent error messages):
error[E0308]: mismatched types
--> src/client/client_future.rs:48:84
|
48 | let fuse: StreamFuse<Receiver<(Message, Complete<ClientResult<Message>>)>> = receiver.fuse();
| ^^^^^^^^^^^^^^^ expected struct `futures::stream::Fuse`, found struct `futures::Fuse`
|
= note: expected type `futures::stream::Fuse<tokio_core::Receiver<(op::message::Message, futures::Complete<std::result::Result<op::message::Message, error::client_error::Error>>)>>`
= note: found type `futures::Fuse<Box<futures::Future<Error=std::io::Error, Item=tokio_core::Receiver<(op::message::Message, futures::Complete<std::result::Result<op::message::Message, error::client_error::Error>>)>> + Send>>`
I've been pedantic in my type usage to make sure everything is clear. What is very confusing is that tokio_core::Receiver should return a stream::Fuse, but claims to be returning a futures::Fuse.
I have an example from a different piece of code, doing something similar and compiles no problem:
https://github.com/bluejekyll/trust-dns/blob/bfry/futures/src/udp/udp_client_stream.rs#L59
the type of the one working is:
stream::Fuse<Receiver<Vec<u8>>>
and the one that is not:
stream::Fuse<Receiver<(Message, Complete<ClientResult<Message>>)>>
both are established through similar calls to LoopHandle::channel
. I am up to date with the futures and tokio_core repos.
cc: @alexcrichton