3Hren/msgpack-rust

`from_read` issue constructing a generic `Deserializer`

tgross35 opened this issue · 1 comments

I am trying to construct a Deserializer for use with serde_transcode, but it is failing:

let mut deserializer: rmp_serde::Deserializer<_> = rmp_serde::from_read(input).unwrap();

input has the type Box<dyn Read>. The converse does seem to work:

let mut serializer = rmp_serde::Serializer::new(output);

What is the correct construction?

I am not sure, but this might relate to #306

If that is the case, could something like serde_json's `IoRead' be added to this crate? It seems like this is the wrapper they use to buffer input.

As an example, this works:

let mut deserializer: serde_json::Deserializer<serde_json::de::IoRead<Box<dyn Read>>> =
    serde_json::Deserializer::from_reader(input);