#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum LifecycleState {
Ready,
Running,
Stopping,
Stopped,
}
impl LifecycleState {
pub const fn can_transition_to(self, next: Self) -> bool {
matches!(
(self, next),
(Self::Ready, Self::Running)
| (Self::Ready, Self::Stopped)
| (Self::Running, Self::Stopping)
| (Self::Stopping, Self::Stopped)
)
}
}