pub type Result = std::result::Result; #[derive(Debug)] pub struct Error { message: String, } impl std::fmt::Display for Error { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(f, "{}", &self.message) } } impl Error { pub fn new(message: &str) -> Self { Error { message: message.to_string(), } } } impl From for Error { fn from(source: T) -> Self { Self { message: source.to_string(), } } } impl From for emacs::Error { fn from(source: Error) -> Self { emacs::Error::msg(source) } }