#[non_exhaustive]
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
pub enum ServerStatus {
Starting,
Ready,
Paused,
Unavailable,
Stopping,
Stopped,
}
impl ServerStatus {
pub(crate) const fn from_u8(val: u8) -> Self {
match val {
0 => ServerStatus::Starting,
1 => ServerStatus::Ready,
2 => ServerStatus::Paused,
3 => ServerStatus::Unavailable,
4 => ServerStatus::Stopping,
_ => ServerStatus::Stopped,
}
}
pub(crate) const fn as_u8(self) -> u8 {
match self {
ServerStatus::Starting => 0,
ServerStatus::Ready => 1,
ServerStatus::Paused => 2,
ServerStatus::Unavailable => 3,
ServerStatus::Stopping => 4,
ServerStatus::Stopped => 5,
}
}
}