Fix JsonHeaderParser::serialize()
This commit is contained in:
parent
7549db4ffc
commit
2bab3d48e6
1 changed files with 13 additions and 4 deletions
|
@ -103,13 +103,22 @@ impl Serialize for FileHeaderData {
|
|||
&FileHeaderData::Float(ref f) => f.serialize(ser),
|
||||
&FileHeaderData::Text(ref s) => (&s[..]).serialize(ser),
|
||||
&FileHeaderData::Array{values: ref vs} => vs.serialize(ser),
|
||||
&FileHeaderData::Map{keys: ref ks} => ks.serialize(ser),
|
||||
&FileHeaderData::Key{name: ref n, value: ref v} => {
|
||||
&FileHeaderData::Map{keys: ref ks} => {
|
||||
let mut hm = HashMap::new();
|
||||
|
||||
for key in ks {
|
||||
if let &FileHeaderData::Key{name: ref n, value: ref v} = key {
|
||||
hm.insert(n, v);
|
||||
hm.serialize(ser)
|
||||
} else {
|
||||
panic!("Not a key: {:?}", key);
|
||||
}
|
||||
}
|
||||
|
||||
hm.serialize(ser)
|
||||
},
|
||||
&FileHeaderData::Key{name: ref n, value: ref v} => unreachable!(),
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue