Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

from_read issue constructing a generic Deserializer #324

Open
tgross35 opened this issue Jan 7, 2023 · 1 comment
Open

from_read issue constructing a generic Deserializer #324

tgross35 opened this issue Jan 7, 2023 · 1 comment

Comments

@tgross35
Copy link

tgross35 commented Jan 7, 2023

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?

@tgross35
Copy link
Author

tgross35 commented Jan 7, 2023

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);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant