aboutsummaryrefslogtreecommitdiffstats
path: root/src/binary.rs
diff options
context:
space:
mode:
authorEdward Barnard2015-08-28 20:12:51 +0700
committerEdward Barnard2015-08-28 20:12:51 +0700
commit25425310fdfdc76dd3804857257d862f81eb0134 (patch)
tree254a5d17266b452628cacc3677ad4cbcaa63980d /src/binary.rs
parent9dff0a814af2ac934b9df97b52b51f799fcbbe90 (diff)
downloadrust-plist-25425310fdfdc76dd3804857257d862f81eb0134.tar.bz2
Remove Error variant from PlistEvent
Diffstat (limited to 'src/binary.rs')
-rw-r--r--src/binary.rs11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/binary.rs b/src/binary.rs
index c189c1a..0f1b707 100644
--- a/src/binary.rs
+++ b/src/binary.rs
@@ -225,12 +225,13 @@ impl<R: Read+Seek> StreamingParser<R> {
}
impl<R: Read+Seek> Iterator for StreamingParser<R> {
- type Item = PlistEvent;
+ type Item = ParserResult<PlistEvent>;
- fn next(&mut self) -> Option<PlistEvent> {
+ fn next(&mut self) -> Option<ParserResult<PlistEvent>> {
match self.read_next() {
- Ok(result) => result,
- Err(err) => Some(PlistEvent::Error(err))
+ Ok(Some(result)) => Some(Ok(result)),
+ Err(err) => Some(Err(err)),
+ Ok(None) => None
}
}
}
@@ -249,7 +250,7 @@ mod tests {
let reader = File::open(&Path::new("./tests/data/binary.plist")).unwrap();
let streaming_parser = StreamingParser::new(reader);
- let events: Vec<PlistEvent> = streaming_parser.collect();
+ let events: Vec<PlistEvent> = streaming_parser.map(|e| e.unwrap()).collect();
let comparison = &[
StartPlist,