use crate::Error;
#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
pub enum Tsi {
#[default]
None,
Utc,
Gps,
Other,
}
impl TryFrom<u8> for Tsi {
type Error = Error;
fn try_from(value: u8) -> Result<Self, Self::Error> {
match value {
0 => Ok(Tsi::None),
1 => Ok(Tsi::Utc),
2 => Ok(Tsi::Gps),
3 => Ok(Tsi::Other),
_ => Err(Error::Tsi(value)),
}
}
}
impl From<Tsi> for u8 {
fn from(tsi: Tsi) -> u8 {
match tsi {
Tsi::None => 0,
Tsi::Utc => 1,
Tsi::Gps => 2,
Tsi::Other => 3,
}
}
}