working sections parse

This commit is contained in:
NikVolf
2017-03-29 19:40:51 +03:00
parent 4ab9e569d1
commit 3fa3a96d3a
3 changed files with 13 additions and 3 deletions

View File

@ -10,9 +10,12 @@ impl Deserialize for Section {
type Error = Error;
fn deserialize<R: io::Read>(reader: &mut R) -> Result<Self, Self::Error> {
let id = VarUint7::deserialize(reader)?;
let id = match VarUint7::deserialize(reader) {
// todo: be more selective detecting no more section
Err(_) => { return Err(Error::UnexpectedEof); },
Ok(id) => id,
};
let unparsed = Unparsed::deserialize(reader)?;
Ok(Section {
id: id.0,
unparsed: unparsed,