From ba0d95233305ae734dc852d4e3a79a48ac7b42d8 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Thu, 24 Mar 2016 12:29:42 +0100 Subject: [PATCH] Impl From for RuntimeError --- libimagrt/src/error.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/libimagrt/src/error.rs b/libimagrt/src/error.rs index cbef32d6..5ad5ea3d 100644 --- a/libimagrt/src/error.rs +++ b/libimagrt/src/error.rs @@ -2,6 +2,7 @@ use std::error::Error; use std::fmt::Display; use std::fmt::Formatter; use std::fmt::Error as FmtError; +use std::io::Error as IOError; #[derive(Debug, PartialEq, Clone, Copy)] pub enum RuntimeErrorKind { @@ -58,3 +59,11 @@ impl Error for RuntimeError { } +impl From for RuntimeError { + + fn from(ioe: IOError) -> RuntimeError { + RuntimeError::new(RuntimeErrorKind::IOError, Some(Box::new(ioe))) + } + +} +