diff options
| author | Edward Barnard | 2015-12-22 11:39:19 +0000 |
|---|---|---|
| committer | Edward Barnard | 2015-12-22 11:39:19 +0000 |
| commit | 139c96123b04c2ed34d17cd0864ef5ae66676ef4 (patch) | |
| tree | 744c99d2a907243f474662677272be57638d200b /src/builder.rs | |
| parent | 3e2ae39ef4d81d986830218e000e65eb0dce9c94 (diff) | |
| download | rust-plist-139c96123b04c2ed34d17cd0864ef5ae66676ef4.tar.bz2 | |
Rename StreamingParser to EventReader and Writer to EventWriter
Diffstat (limited to 'src/builder.rs')
| -rw-r--r-- | src/builder.rs | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/builder.rs b/src/builder.rs index fc33e1e..0b17f97 100644 --- a/src/builder.rs +++ b/src/builder.rs @@ -1,7 +1,7 @@ use std::collections::BTreeMap; use std::io::{Read, Seek}; -use {ParserError, ParserResult, Plist, PlistEvent, StreamingParser}; +use {ReadError, ReadResult, Plist, PlistEvent, EventReader}; pub type BuilderResult<T> = Result<T, BuilderError>; @@ -9,12 +9,12 @@ pub type BuilderResult<T> = Result<T, BuilderError>; pub enum BuilderError { InvalidEvent, UnsupportedDictionaryKey, - ParserError(ParserError) + ReadError(ReadError) } -impl From<ParserError> for BuilderError { - fn from(err: ParserError) -> BuilderError { - BuilderError::ParserError(err) +impl From<ReadError> for BuilderError { + fn from(err: ReadError) -> BuilderError { + BuilderError::ReadError(err) } } @@ -23,13 +23,13 @@ pub struct Builder<T> { token: Option<PlistEvent>, } -impl<R: Read+Seek> Builder<StreamingParser<R>> { - pub fn new(reader: R) -> Builder<StreamingParser<R>> { - Builder::from_event_stream(StreamingParser::new(reader)) +impl<R: Read+Seek> Builder<EventReader<R>> { + pub fn new(reader: R) -> Builder<EventReader<R>> { + Builder::from_event_stream(EventReader::new(reader)) } } -impl<T:Iterator<Item=ParserResult<PlistEvent>>> Builder<T> { +impl<T:Iterator<Item=ReadResult<PlistEvent>>> Builder<T> { pub fn from_event_stream(stream: T) -> Builder<T> { Builder { stream: stream, @@ -57,7 +57,7 @@ impl<T:Iterator<Item=ParserResult<PlistEvent>>> Builder<T> { fn bump(&mut self) -> BuilderResult<()> { self.token = match self.stream.next() { Some(Ok(token)) => Some(token), - Some(Err(err)) => return Err(BuilderError::ParserError(err)), + Some(Err(err)) => return Err(BuilderError::ReadError(err)), None => None, }; Ok(()) |
