Skip to content

Commit

Permalink
enabling deserialization of lowercase values to enums
Browse files Browse the repository at this point in the history
  • Loading branch information
YounessBird committed Jul 5, 2022
1 parent 2d74d06 commit 9c28d12
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/de.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ impl EnumAccess {
fn variant_deserializer(&self, name: &str) -> Result<StrDeserializer> {
self.variants
.iter()
.find(|&&s| s == name)
.find(|&&s| s.to_lowercase() == name.to_lowercase()) // changing to lowercase will enable deserialization of lowercase values to enums
.map(|&s| StrDeserializer(s))
.ok_or_else(|| self.no_constructor_error(name))
}
Expand Down

0 comments on commit 9c28d12

Please sign in to comment.