From 316778ccd93d7f268f92bc859e4ace86bdc5985f Mon Sep 17 00:00:00 2001 From: meh Date: Tue, 22 Sep 2015 04:03:49 +0200 Subject: [PATCH] error: implement From for io::Error --- src/util/error.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/util/error.rs b/src/util/error.rs index 5aafaa2..74fa544 100644 --- a/src/util/error.rs +++ b/src/util/error.rs @@ -1,4 +1,5 @@ use std::error; +use std::io; use std::fmt; use std::ffi::CStr; use std::str::from_utf8_unchecked; @@ -110,6 +111,12 @@ impl Into for Error { } } +impl From for io::Error { + fn from(value: Error) -> io::Error { + io::Error::new(io::ErrorKind::Other, value) + } +} + impl fmt::Display for Error { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { f.write_str(error::Error::description(self))