-
Notifications
You must be signed in to change notification settings - Fork 215
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
Enum variant aliases don't work #502
Comments
2 tasks
In Lines 279 to 293 in 57fb261
Lines 244 to 250 in 57fb261
I got a straightforward fix to demostrate this, it is not the best. diff --git a/src/de.rs b/src/de.rs
index 0e2b8de..4d014e9 100644
--- a/src/de.rs
+++ b/src/de.rs
@@ -313,8 +313,13 @@ impl<'de> de::EnumAccess<'de> for EnumAccess {
ValueKind::String(ref s) => self.variant_deserializer(s),
ValueKind::Table(ref t) => self.table_deserializer(t),
_ => Err(self.structural_error()),
- }?;
- seed.deserialize(deserializer)?
+ };
+ if let Ok(deserializer) = deserializer {
+ seed.deserialize(deserializer)?
+ } else {
+ let deserializer = self.value.clone();
+ seed.deserialize(deserializer)?
+ }
};
Ok((value, self))
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here is a failing example demonstrating that enum variant aliases are not taken into account. It also shows a divergence in behavior compared to using
serde_json
directly.Output:
The text was updated successfully, but these errors were encountered: