Correctly serialize newtype variants for flatten

This commit is contained in:
Armin Ronacher
2018-03-20 23:05:05 +01:00
parent 99614c7266
commit 27f935f036
2 changed files with 37 additions and 2 deletions
+3 -2
View File
@@ -1161,13 +1161,14 @@ impl<'a, M> Serializer for FlatMapSerializer<'a, M>
self,
_: &'static str,
_: u32,
_: &'static str,
variant: &'static str,
value: &T,
) -> Result<Self::Ok, Self::Error>
where
T: Serialize,
{
value.serialize(self)
try!(self.0.serialize_key(variant));
self.0.serialize_value(value)
}
fn serialize_seq(self, _: Option<usize>) -> Result<Self::SerializeSeq, Self::Error> {