Skip to content

Commit

Permalink
Merge pull request #23 from nagy/from-ioerror
Browse files Browse the repository at this point in the history
Support conversion to std::io::Error
  • Loading branch information
nlfiedler authored Mar 1, 2023
2 parents bcf405d + e9523d3 commit 5e9a7c7
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/v2016/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,16 @@ impl From<std::io::Error> for Error {
}
}

impl From<Error> 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.
///
Expand Down
10 changes: 10 additions & 0 deletions src/v2020/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,16 @@ impl From<std::io::Error> for Error {
}
}

impl From<Error> 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.
///
Expand Down

0 comments on commit 5e9a7c7

Please sign in to comment.