macro_rules! impl_error {
($ErrorName:ident, $ErrorType:ident) => { ... };
}Available on crate feature
alloc only.Expand description
Macro to build a fairly standard error struct.
ⓘ
extern crate alloc;
#[derive(Debug, Clone, Eq, PartialEq)]
pub struct ErrorName {
error_type: ErrorType,
msg: alloc::string::String,
}
impl core::fmt::Display for ErrorName {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
f.write_fmt(format_args!("{:?}: {}", self.error_type, self.msg))
}
}
#[cfg(feature = "std")]
impl std::error::Error for ErrorName {}