diff options
Diffstat (limited to 'src/error.rs')
-rw-r--r-- | src/error.rs | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/src/error.rs b/src/error.rs index 6358bfe..19bd48d 100644 --- a/src/error.rs +++ b/src/error.rs @@ -4,19 +4,8 @@ pub trait IntoIOError { fn ioerr(self) -> io::Error; } -impl IntoIOError for String { - fn ioerr(self) -> io::Error { - io::Error::new(io::ErrorKind::Other, self) - } -} - -impl IntoIOError for &str { - fn ioerr(self) -> io::Error { - io::Error::new(io::ErrorKind::Other, self) - } -} - -impl IntoIOError for std::string::FromUtf8Error { +// This impl bound is taken directly from the io::Error::new function. +impl<E: Into<Box<dyn std::error::Error + Send + Sync>>> IntoIOError for E { fn ioerr(self) -> io::Error { io::Error::new(io::ErrorKind::Other, self) } |