Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upbincode error while deserializing file with option #52
Comments
|
Are you implementing the serde serializer and deserializer by hand, or are you using serde's compiler plugin to do it for you? |
|
I used serde_macros on nightly. |
|
Hmm. That shouldn't happen. Are you sure that the struct didn't change between when you serialized the file and when you deserialized it? |
|
I've just run it again with the same results.
|
|
Ok, I'll need to see your code, is it public somewhere? |
|
Gist for repro - https://gist.github.com/ghotiphud/c97ac187a088a45e7d0a Library to gather data - https://github.com/ghotiphud/edmunds-rs You'll need an API key to access the Edmunds Api, but I'll loan you my test one. Should I send it to ty@pre-alpha.com? |
|
I'm pretty sure that Bincode relies on the serializer and deserializer following the exact same steps, so if serialization doesn't serialize something, and deserialization expects it to be there, then everything breaks. I'll do some more experimenting and add this as a warning to the readme. |
|
That worked! Is there any way to just ignore fields completely for serialization and deserialization? |
|
It should be possible to define a newtype struct like this: struct Ignore<T: Default>(T);
and then
This might be handy enough that I could just include it in Bincode. |
|
I think it would be most handy in serde, at least for my use case... basically saving a Json response off to a file while ignoring some fields. But for my current experiment, avoiding |
|
Apparently serde has |
I'm going to attempt to build a repro case, but it might take me a while. Thought maybe this would mean more to you than me.