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
Can't deserialize entire file #317
Comments
Make a PR that adds |
@kornelski 🤔 do you mean |
(I'm happy to have a bash, but I'm a real newbie to Rust, so not sure I'll manage haha) |
I assume you mean |
Ah... Hmmm 🤔 What does I thought making an iterator - because that seems to be how Python's msgpack implementation works (https://github.com/msgpack/msgpack-python/blob/500a238028bdebe123b502b07769578b5f0e8a3a/msgpack/_unpacker.pyx#L539-L540).
Also - |
In that case I'm completely confused about what you want. Serde fundamentally creates a single object of a given type. There is nothing to iterate in the decoder. Even if you deserialize a vector, you iterate the vector, not the decoder. I thought you meant into_inner that returns the io::Reader so that you can recycle it for other I/O operations. That's not related to iteration. |
Ah - okay - let me clarify. If you have serialized the following array of objects into msgpack:
We should be able to read all of them - out of a file stream. However, once serde_rmp reaches the end of the first object (probably some delineating character?), it concludes decoding, despite the fact there's loads of information still to be read out of the buffer. You can actually see this if you print out the bytes read by I thought about Does that make any more sense @kornelski ? |
I don't think that's a correct usage of serde. Serde is a type-based one-shot deserializer, not a streaming deserializer. It gives you one and exactly one object of the type you've requested. If you've requested a single struct, that's all you will ever get. Two objects next to each other is not a type. If you have multiple objects to deserialize with serde, the deserialize them all into a single |
I can't deserialize an entire file because the Deserializer does not implement
into_iter
as other serde libraries do.How can I get around this?
Code thus far is:
The text was updated successfully, but these errors were encountered: