use core::fmt::Debug;
pub enum Outcome<S> {
Handled,
Super,
Transition(S),
}
#[deprecated(since = "0.4", note = "`Response` has been renamed to `Outcome`")]
pub type Response<S> = Outcome<S>;
impl<S> PartialEq for Outcome<S>
where
S: PartialEq,
{
fn eq(&self, other: &Self) -> bool {
match (self, other) {
(Self::Handled, Self::Handled) => true,
(Self::Super, Self::Super) => true,
(Self::Transition(s), Self::Transition(o)) => s == o,
_ => false,
}
}
}
impl<S> Eq for Outcome<S> where S: Eq {}
impl<S> Debug for Outcome<S>
where
S: Debug,
{
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
Self::Handled => f.debug_tuple("Handled").finish(),
Self::Super => f.debug_tuple("Super").finish(),
Self::Transition(state) => f
.debug_tuple("Transition")
.field(state as &dyn Debug)
.finish(),
}
}
}