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