Impl From<IOError> for RuntimeError

This commit is contained in:
Matthias Beyer 2016-03-24 12:29:42 +01:00
parent 75ff2c742f
commit ba0d952333

View file

@ -2,6 +2,7 @@ use std::error::Error;
use std::fmt::Display; use std::fmt::Display;
use std::fmt::Formatter; use std::fmt::Formatter;
use std::fmt::Error as FmtError; use std::fmt::Error as FmtError;
use std::io::Error as IOError;
#[derive(Debug, PartialEq, Clone, Copy)] #[derive(Debug, PartialEq, Clone, Copy)]
pub enum RuntimeErrorKind { pub enum RuntimeErrorKind {
@ -58,3 +59,11 @@ impl Error for RuntimeError {
} }
impl From<IOError> for RuntimeError {
fn from(ioe: IOError) -> RuntimeError {
RuntimeError::new(RuntimeErrorKind::IOError, Some(Box::new(ioe)))
}
}