use core::fmt; pub type MLE = Result; #[derive(Debug)] pub struct MLError { etype: ErrorType, message: String, } #[derive(Debug)] pub enum ErrorType { ArgumentError } impl std::error::Error for MLError { fn description(&self) -> &str { &self.message } } impl fmt::Display for MLError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self.etype { ErrorType::ArgumentError => write!(f, "ARGS") } } } impl MLError { pub fn new(etype: ErrorType, message: &str) -> Self { Self { etype, message: String::from(message) } } }