summaryrefslogtreecommitdiff
path: root/src/error.rs
diff options
context:
space:
mode:
authortomsmeding <tom.smeding@gmail.com>2020-01-09 12:05:15 +0100
committertomsmeding <tom.smeding@gmail.com>2020-01-09 12:05:15 +0100
commit3a8069d1a46578c810f24c7b1b092251ffc22c39 (patch)
tree28ed68289f61524978a30202ac1c5638044526a3 /src/error.rs
parent718f0e27302a968058a0d234ae6fb5969cd66adf (diff)
Even more stuff
Diffstat (limited to 'src/error.rs')
-rw-r--r--src/error.rs15
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)
}