macro_rules! impl_reason_error_boilerplate {
($type:ident { $($variant:ident),+ $(,)? }) => {
impl ::std::fmt::Display for $type {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match self {
$(Self::$variant { reason })|+ => f.write_str(reason),
}
}
}
impl ::std::error::Error for $type {}
impl From<$type> for String {
fn from(err: $type) -> String {
err.to_string()
}
}
};
}