diff --git a/src/v2016/mod.rs b/src/v2016/mod.rs index 6fc9192..abb8395 100644 --- a/src/v2016/mod.rs +++ b/src/v2016/mod.rs @@ -418,6 +418,16 @@ impl From for Error { } } +impl From for std::io::Error { + fn from(error: Error) -> Self { + match error { + Error::IoError(ioerr) => ioerr, + Error::Empty => Self::from(std::io::ErrorKind::UnexpectedEof), + Error::Other(str) => Self::new(std::io::ErrorKind::Other, str), + } + } +} + /// /// Represents a chunk returned from the StreamCDC iterator. /// diff --git a/src/v2020/mod.rs b/src/v2020/mod.rs index df7c521..1e52038 100644 --- a/src/v2020/mod.rs +++ b/src/v2020/mod.rs @@ -506,6 +506,16 @@ impl From for Error { } } +impl From for std::io::Error { + fn from(error: Error) -> Self { + match error { + Error::IoError(ioerr) => ioerr, + Error::Empty => Self::from(std::io::ErrorKind::UnexpectedEof), + Error::Other(str) => Self::new(std::io::ErrorKind::Other, str), + } + } +} + /// /// Represents a chunk returned from the StreamCDC iterator. ///