-
-
Notifications
You must be signed in to change notification settings - Fork 836
Description
While working on deserializing json data to an enum I wanted to use the enum variant deserialize_with feature.
I first tried it with my own data structure, which fails with "invalid type: unit variant, expected newtype variant".
The tiny program can be found at: https://github.com/andete/blog-code/blob/master/serde_deserialize_enum_1/src/bin/6.rs
To be sure I understood the approach correctly I looked at the serde testsuite and created the following example program based on a testcase in the test suite:
https://github.com/andete/blog-code/blob/master/serde_deserialize_enum_1/src/bin/6a.rs
This one fails differently with: "ExpectedSomeValue, line: 1, column: 1".
I hope I'm misinterpreting the docs and doing something wrong, else perhaps there is an issue with this feature. The testsuite test does not fail however. Maybe it is some issue that only happens when serde is combined with an actual data structure (serde_json in this case) as the testsuite test does not.