-
Notifications
You must be signed in to change notification settings - Fork 117
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
Deserializing with serde yields invalid type
error
#167
Comments
This is a "real" bug I think. I've run into this as well, both using use bitvec::{ bitvec, order::Lsb0, vec::BitVec };
use serde::Deserialize;
let original = bitvec![u8, Lsb0; 0, 1, 1, 0, 0, 1, 1, 1, 0];
let json = serde_json::to_value(&original).unwrap();
let out = BitVec::<u8, Lsb0>::deserialize(json);
assert_eq!(out.unwrap(), original); And the error encountered is:
Serializing is fine. When we come to deserialize, I think that thw following happens, leading to the error:
I wonder whether the fix is as simple as changing the |
Hello!
I just started using
bitvec
, thanks for the really cool project! I learned a great deal by reading the documentation. 🙌As a fairly novice user of Rust still, I'm stumped with the following behaviour I ran into. Serializing a BitVec to a file, and deserializing from the file yields an
invalid type: string "order", expected a borrowed string at ...
error. Here's the smallest program that reproduces the issue for me:I expected the deserialization to succeed, yielding an identical
Bits
instance as the one serialized. I've tried this with bothserde_json
andbincode
, and observed the same result.I'm still getting smacked around the compiler a lot, so I am actually not quite sure if the issue is on my end or not 😅
The text was updated successfully, but these errors were encountered: