mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-11-05 00:51:06 +00:00
Complete coverage of ContentRefDeserializer::deserialize_newtype_struct
This commit is contained in:
1 parent
2dddc7796d
commit
171c6da57a
2 files changed
+15
-1
No files matched your search
@@ -1938,10 +1938,17 @@ mod content {
|
||||
where
|
||||
V: Visitor<'de>,
|
||||
{
|
||||
// Covered by tests/test_enum_untagged.rs
|
||||
// newtype_struct
|
||||
match *self.content {
|
||||
Content::Newtype(ref v) => {
|
||||
visitor.visit_newtype_struct(ContentRefDeserializer::new(v))
|
||||
}
|
||||
// This case is necessary for formats which does not store marker of a newtype,
|
||||
// for example, JSON. When `deserialize_any` is requested from such formats, they will
|
||||
// report value without using `Visitor::visit_newtype_struct`, because they do not
|
||||
// known in which contexts this value will be used.
|
||||
// RON is example of format which preserve markers.
|
||||
_ => visitor.visit_newtype_struct(self),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user