Implement `std::error::FromError<byteorder::Error>` for `std::io::Error`
diff --git a/src/new.rs b/src/new.rs
index 2d7e297..e8ee1a6 100644
--- a/src/new.rs
+++ b/src/new.rs
@@ -30,6 +30,16 @@
fn from_error(err: io::Error) -> Error { Error::Io(err) }
}
+impl error::FromError<Error> for io::Error {
+ fn from_error(err: Error) -> io::Error {
+ match err {
+ Error::Io(err) => err,
+ Error::UnexpectedEOF => io::Error::new(io::ErrorKind::Other,
+ "unexpected EOF", None)
+ }
+ }
+}
+
impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {