From 219de2dd4d60420f810cb60496d41f164e5c06b0 Mon Sep 17 00:00:00 2001 From: Garrett Berg Date: Wed, 26 Jul 2017 22:08:22 -0600 Subject: close #199: add header information for empty structs - also add test which fails without this change - also add a few helpful unit tests to table --- src/ser.rs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src') diff --git a/src/ser.rs b/src/ser.rs index 863bd75..3c9b354 100644 --- a/src/ser.rs +++ b/src/ser.rs @@ -930,6 +930,15 @@ impl<'a, 'b> ser::SerializeStruct for SerializeTable<'a, 'b> { } fn end(self) -> Result<(), Error> { + match self { + SerializeTable::Datetime(_) => {}, + SerializeTable::Table { mut ser, first, .. } => { + if first.get() { + let state = ser.state.clone(); + ser.emit_table_header(&state)?; + } + } + } Ok(()) } } -- cgit v1.2.3