use alloc::string::String;
use core::fmt;
#[derive(Clone, Debug)]
pub struct Error {
message: String,
}
impl Error {
pub(crate) fn new<S: Into<String>>(message: S) -> Error {
Error {
message: message.into(),
}
}
}
#[cfg(feature = "std")]
impl std::error::Error for Error {
fn description(&self) -> &str {
&self.message
}
}
impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
f.pad(&self.message)
}
}