Unpack a layer of NewtypeStruct when content is newtype

This commit is contained in:
David Tolnay
2018-04-23 10:51:49 -07:00
parent f46a08b04e
commit bceda5fb18
2 changed files with 60 additions and 2 deletions
+12 -2
View File
@@ -1310,7 +1310,12 @@ mod content {
where
V: Visitor<'de>,
{
visitor.visit_newtype_struct(self)
match self.content {
Content::Newtype(v) => {
visitor.visit_newtype_struct(ContentDeserializer::new(*v))
}
_ => visitor.visit_newtype_struct(self),
}
}
fn deserialize_seq<V>(self, visitor: V) -> Result<V::Value, Self::Error>
@@ -2001,7 +2006,12 @@ mod content {
where
V: Visitor<'de>,
{
visitor.visit_newtype_struct(self)
match *self.content {
Content::Newtype(ref v) => {
visitor.visit_newtype_struct(ContentRefDeserializer::new(v))
}
_ => visitor.visit_newtype_struct(self),
}
}
fn deserialize_seq<V>(self, visitor: V) -> Result<V::Value, Self::Error>