diff --git a/src/de.rs b/src/de.rs index 7157ced..8063944 100644 --- a/src/de.rs +++ b/src/de.rs @@ -516,12 +516,16 @@ where visitor.visit_enum(Enum::<'a, R>(self)) } - /// Returns Error::IdentifierUnsupported. - fn deserialize_identifier(self, _visitor: V) -> Result + /// Deserialize the enum discriminant as a BARE Uint + fn deserialize_identifier(self, visitor: V) -> Result where V: de::Visitor<'de>, { - Err(Error::IdentifierUnsupported) + let Uint(id) = ::deserialize(&mut *self)?; + let variant: u32 = id.try_into().map_err(|_| { + Error::Message("Enum identifiers larger than u32 are not supported".to_string()) + })?; + visitor.visit_u32(variant) } /// Returns Error::AnyUnsupported.