pub trait Error {
fn name(&self) -> &'static str;
fn msg(&self) -> Option<String>;
}
pub enum CommonError {
StringError(&'static str)
}
impl Error for CommonError {
fn name(&self) -> &'static str {
match self {
CommonError::StringError(_) => { "string error" }
}
}
fn msg(&self) -> Option<String> {
match self {
CommonError::StringError(msg) => { return Some(msg.to_string()); }
}
}
}