-
-
Notifications
You must be signed in to change notification settings - Fork 275
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
Convenience API for skipping data? #154
Comments
https://serde.rs/ignored-any.html may be relevant |
I'm using bincode, so I need to give the fields a type. |
@gankro serde 1.0 introduces zero copy deserialization, so as soon support for 1.0 is finished you should be able to use that to similar effect. |
Zero copy deserialization only works on bytes and strs; my slices contain actual types that need to be materialized into a new buffer. |
I see. Well in the mean time maybe you could use borrowed_bytes with a wrapper struct and interpret the bytes lazily when needed? I'm not sure if that's easy or doable I'm just thinking out loud. |
@Xaeroxe: that's what I suggested in #serde a few days ago. Unfortunately it would require serializing extra "length" bytes into the output, so for lots of tiny structs this isn't an option. |
Hmm I wonder if it's possible to do this using generics so the length is coded into the executable rather than the memory representation. I might look into that. |
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. |
I'm working on a format where I have several arrays in my data stream that I don't want to deserialize right away, but instead jump over and deserialize on demand later (element-by-element).
It would be nice if there was methods like:
Bincode might be able to implement this better than I could naively, by using things like fixed-serialized-size info to skip over everything without any parsing in O(1). In general this API needs to parse (enums), but it can basically be like "it only parses as much as is needed to skip over the data".
The text was updated successfully, but these errors were encountered: