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

Failing to deserialize #79

Open
XBagon opened this issue Oct 3, 2022 · 1 comment
Open

Failing to deserialize #79

XBagon opened this issue Oct 3, 2022 · 1 comment

Comments

@XBagon
Copy link

XBagon commented Oct 3, 2022

Hey, currently struggling with deserializing just serialized structs again. Sadly not getting much info for why, just getting an Serde Deserialization Error.
This is the implementation of my test:
https://github.com/XBagon/gears/blob/egg/gears_core/src/gear_file.rs#L84
I feel like my struct isn't that complicated and I haven't done any manual Ser/De implemenations, so I'm struggling to even find a start where to debug :P.

Probably a whole test suite of just serializing and directly deserializing some example structs - maybe some of popular structs to catch stuff like #77 - would make sense for a crate like this?

djkoloski added a commit to djkoloski/serde that referenced this issue Oct 7, 2022
On enums with a skipped variant that is not the last one, the generated
serialization and deserialization code map the variants of the enum to
different variant indices. In `deserialize_identifier`, the variant
index starts at 0 and counts up once per non-skipped variant. However,
for serialization the index is always the index of the variant within
the enum.

This PR corrects the deserialization code to always use the index of the
variant within the enum.

This was surfaced in jamesmunns/postcard#79.
@iFreilicht
Copy link
Contributor

Agreed, some rountrip tests could be very beneficial.

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

2 participants