From 9c28d1279d470f4d2a6c3e2c7337382008ef85a5 Mon Sep 17 00:00:00 2001 From: YounessBird <67457600+YounessBird@users.noreply.github.com> Date: Wed, 29 Jun 2022 22:33:58 +0100 Subject: [PATCH] enabling deserialization of lowercase values to enums --- src/de.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/de.rs b/src/de.rs index d1271b2b..96c5b5e2 100644 --- a/src/de.rs +++ b/src/de.rs @@ -246,7 +246,7 @@ impl EnumAccess { fn variant_deserializer(&self, name: &str) -> Result { 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)) }