-
Notifications
You must be signed in to change notification settings - Fork 3
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
Add optional user-controlled version tag #2
Comments
I was trying to come up with a solution how to automate this or make it less error-prone and have to write less manual code.
Just brain-dumping, hope you find any of it useful. |
My understanding of proc macros is that what you wrote is impossible. I was pretty sure that proc macros only can operate on the type they're being attached to and cannot find any other code outside of the TokenStream its associated with. If my assumption is correct, then
I don't think this is possible, because at the point that the If I proceed with allowing streaming deserialization of payloads, I don't think there's a way to use with. I do think we can improve dataversion, but I'm also pretty sold on this being separate from Pot at this point. I don't have a good enough reason to leave it in Pot. |
I did -- and this is what I meant by deserializing receiving a Read generic. The complexity arises from needing to be able to peek-read the header, in case we decide it's not actually a One bonus of how I think we can still improve |
It can't find anything. But if you write We also don't need access to the contents, it can't implement the
I had to read this a couple of times, lol, I'm very much out of the serialization game. The reason I'm proposing the I'm sry if I'm not understanding something here properly.
That sounds great to me. |
After discussing on Discord we got on the same page. The process will be continued at khonsulabs/dataversion, although I may rename that crate depending on what all it tackles. |
One common problem with long-lived serialized types is version compatibility. Sometimes, it's best to just start fresh with a structure design. I realized that since Pot has a built-in version header, we could adopt a new version that supports encoding a single integer value at the front of the Pot file.
Parsing a Pot file would use an API like this:
I'm sure an even better pattern can be devised, but that snippet should get the idea across of what I want to accomplish. Parsing a file with an older header would call the callback with 0, allowing someone to upgrade to this new flow from existing data without any breaking changes.
The text was updated successfully, but these errors were encountered: