use std::error::Error; use std::fmt; use std::io; pub mod ntriples; pub mod turtle; pub type RioResult = Result; #[derive(Debug)] pub struct RioError { error: Box, } impl RioError { pub fn new(error: E) -> RioError where E: Into>, { RioError { error: error.into(), } } } impl From for RioError { fn from(error: io::Error) -> Self { RioError::new(error) } } impl fmt::Display for RioError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { self.error.fmt(f) } } impl Error for RioError { fn description(&self) -> &str { self.error.description() } fn cause(&self) -> Option<&Error> { Some(&*self.error) } }