Close #180
This commit is contained in:
parent
2c70f6961c
commit
d8cc119799
20
src/ser.rs
20
src/ser.rs
|
@ -308,6 +308,26 @@ impl<'a> Serializer<'a> {
|
|||
State::Array { .. } => true,
|
||||
_ => false,
|
||||
};
|
||||
|
||||
// Unlike [..]s, we can't omit [[..]] ancestors, so be sure to emit table
|
||||
// headers for them.
|
||||
let mut p = state;
|
||||
if let State::Array { first, parent, .. } = *state {
|
||||
if first.get() {
|
||||
p = parent;
|
||||
}
|
||||
}
|
||||
while let State::Table { first, parent, .. } = *p {
|
||||
p = parent;
|
||||
if !first.get() {
|
||||
break;
|
||||
}
|
||||
if let State::Array { parent: &State::Table {..}, ..} = *parent {
|
||||
self.emit_table_header(parent)?;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
match *state {
|
||||
State::Table { first, .. } |
|
||||
State::Array { parent: &State::Table { first, .. }, .. } => {
|
||||
|
|
Loading…
Reference in a new issue