diff --git a/src/de/read.rs b/src/de/read.rs index e2d64eb..5235eb9 100644 --- a/src/de/read.rs +++ b/src/de/read.rs @@ -61,7 +61,7 @@ impl IoRead for IoReadReader { impl <'storage> SliceReader<'storage> { fn unexpected_eof() -> Box<::ErrorKind> { - return Box::new(::ErrorKind::IoError(IoError::new(IoErrorKind::UnexpectedEof, ""))); + return Box::new(::ErrorKind::Io(IoError::new(IoErrorKind::UnexpectedEof, ""))); } } diff --git a/src/internal.rs b/src/internal.rs index 2090ab8..3baa5a6 100644 --- a/src/internal.rs +++ b/src/internal.rs @@ -34,7 +34,7 @@ pub type Error = Box; pub enum ErrorKind { /// If the error stems from the reader/writer that is being used /// during (de)serialization, that error will be stored and returned here. - IoError(IoError), + Io(IoError), /// If the bytes in the reader are not decodable because of an invalid /// encoding, this error will be returned. This error is only possible /// if a stream is corrupted. A stream produced from `encode` or `encode_into` @@ -57,7 +57,7 @@ pub enum ErrorKind { impl error::Error for ErrorKind { fn description(&self) -> &str { match *self { - ErrorKind::IoError(ref err) => error::Error::description(err), + ErrorKind::Io(ref err) => error::Error::description(err), ErrorKind::InvalidEncoding{desc, ..} => desc, ErrorKind::SequenceMustHaveLength => "bincode can't encode infinite sequences", ErrorKind::SizeLimit => "the size limit for decoding has been reached", @@ -68,7 +68,7 @@ impl error::Error for ErrorKind { fn cause(&self) -> Option<&error::Error> { match *self { - ErrorKind::IoError(ref err) => Some(err), + ErrorKind::Io(ref err) => err.cause(), ErrorKind::InvalidEncoding{..} => None, ErrorKind::SequenceMustHaveLength => None, ErrorKind::SizeLimit => None, @@ -79,16 +79,16 @@ impl error::Error for ErrorKind { impl From for Error { fn from(err: IoError) -> Error { - ErrorKind::IoError(err).into() + ErrorKind::Io(err).into() } } impl fmt::Display for ErrorKind { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { match *self { - ErrorKind::IoError(ref ioerr) => - write!(fmt, "IoError: {}", ioerr), - ErrorKind::InvalidEncoding{desc, detail: None}=> + ErrorKind::Io(ref ioerr) => + write!(fmt, "Io: {}", ioerr), + ErrorKind::InvalidEncoding{desc, detail: None}=> write!(fmt, "InvalidEncoding: {}", desc), ErrorKind::InvalidEncoding{desc, detail: Some(ref detail)}=> write!(fmt, "InvalidEncoding: {} ({})", desc, detail), @@ -195,7 +195,7 @@ pub fn serialized_size_bounded(value: &T, max: u64) -> Option where T: serde::Serialize { let mut size_counter = SizeChecker { - size_limit: CountSize { total: 0, limit: Some(max) } + size_limit: CountSize { total: 0, limit: Some(max) } }; match value.serialize(&mut size_counter) {