mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-04-30 00:37:55 +00:00
Unpack a layer of NewtypeStruct when content is newtype
This commit is contained in:
+12
-2
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user