Impl From<IOError> for RuntimeError
This commit is contained in:
parent
75ff2c742f
commit
ba0d952333
1 changed files with 9 additions and 0 deletions
|
@ -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)))
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue