wrap into workspace

This commit is contained in:
22 changed files with 15 additions and 10 deletions

View File

@@ -0,0 +1,23 @@
use std::fmt::{Display, Formatter};
#[derive(Debug)]
pub struct Error {
message: String,
}
impl Error {
pub fn new(message: impl AsRef<str>) -> Self {
Self {
message: message.as_ref().to_string(),
}
}
}
impl Display for Error {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
f.write_fmt(format_args!("{}", self.message))?;
Ok(())
}
}
impl std::error::Error for Error {}