#[derive(Debug, Clone)]
pub enum TransitionResult {
Stay(String),
Transition {
result: String,
next_node: String,
},
}
impl TransitionResult {
pub fn stay(result: impl Into<String>) -> Self {
Self::Stay(result.into())
}
pub fn transition(result: impl Into<String>, next_node: impl Into<String>) -> Self {
Self::Transition {
result: result.into(),
next_node: next_node.into(),
}
}
pub fn result(&self) -> &str {
match self {
Self::Stay(r) => r,
Self::Transition { result, .. } => result,
}
}
pub fn is_transition(&self) -> bool {
matches!(self, Self::Transition { .. })
}
}