use std::error; use std::fmt; #[derive(Clone)] pub struct RenderError { pub message: String, } #[derive(Clone)] pub struct CompileError { pub message: String, } impl fmt::Display for RenderError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "Error rendering: {}", self.message) } } impl fmt::Debug for RenderError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "Error rendering: {}", self.message) } } impl error::Error for RenderError { fn source(&self) -> Option<&(dyn error::Error + 'static)> { None } } impl fmt::Display for CompileError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "Error rendering: {}", self.message) } } impl fmt::Debug for CompileError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "Error rendering: {}", self.message) } } impl error::Error for CompileError { fn source(&self) -> Option<&(dyn error::Error + 'static)> { None } }