use core::fmt;
#[derive(Debug, Clone, PartialEq, Eq)]
#[non_exhaustive]
pub enum LifecycleError<M> {
TransitionDenied {
from: M,
to: M,
reason: &'static str,
},
}
impl<M: fmt::Display> fmt::Display for LifecycleError<M> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::TransitionDenied { from, to, reason } => {
write!(f, "transition denied from {from} to {to}: {reason}")
}
}
}
}
#[cfg(feature = "std")]
impl<M: fmt::Debug + fmt::Display> std::error::Error for LifecycleError<M> {}