-
-
Notifications
You must be signed in to change notification settings - Fork 272
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
Support serializing to Vec<u8> with unknown seq/map length #167
Comments
Is that a problem in practice? I think the majority of binary serialization formats have problems supporting unknown lengths. |
I'm not sure how useful this. How many people encode using different types than they decode? |
If I'm understanding this suggestion correctly, it would resolve #245. I thought this could be implemented by tracking the index into our underlying The trouble is all of the serialization methods in bincode are generic over the std::Write trait, which doesn't allow the type of access we need into the underlying vec. I'm not sure if there is a better way to handle this? Or if perhaps there are additional trait bounds that would help here without limiting the API too much? Edit - Actually I think there is a way to do this. The |
Any Idea when this will get any kind of fix? :( |
@MTRNord so far there has not been a proposed solution that does not come with significant drawbacks. Implementing this is held up until we can identify an implementation that doesn't come with those drawbacks. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue should be reopened. It's still a big problem, particularly when working with structs involving serde's |
We have decided to declare this issue out of scope. Bincode only officially supports types that serialize to a known length, and the initial proposed solution of going back and rewriting the correct length after serializing the sequence both causes issues with varint encoded lengths, and can not be made general as it can not be assumed that any given writer supports |
When the sequence is done it should go back and write the length in the correct spot.
Though variably encoding the length may make this less feasible - cc #75.
The text was updated successfully, but these errors were encountered: