use crate::error::StateTransition;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum NetworkState {
Unconfigured,
Configuring,
Active,
Cleaned,
}
impl StateTransition for NetworkState {
fn can_transition_to(&self, next: &NetworkState) -> bool {
matches!(
(self, next),
(NetworkState::Unconfigured, NetworkState::Configuring)
| (NetworkState::Configuring, NetworkState::Active)
| (NetworkState::Active, NetworkState::Cleaned)
)
}
fn is_terminal(&self) -> bool {
matches!(self, NetworkState::Cleaned)
}
}