nmeasis 26.4.1

A memory-safe NMEA 0183 parser with a C FFI
Documentation
#[repr(u8)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum FaaMode {
    /// Autonomous Mode
    Autonomous = b'A',
    /// Differential Mode
    Differential = b'D',
    /// Estimated (Dead-Reckoning) Mode
    Estimated = b'E',
    /// Manual Input Mode
    Manual = b'M',
    /// Simulated Mode
    Simulator = b'S',
    /// Data Not Valid
    Invalid = b'N',
    /// RTK Float Mode
    RtkFloat = b'F',
    /// RTK Integer Mode
    RtkFixed = b'R',
    /// Precise (>= NMEA 4.00)
    Precise = b'P',
}

impl FaaMode {
    #[must_use]
    pub fn parse(raw: &str) -> Option<Self> {
        match raw.as_bytes().first() {
            Some(&b'A') => Some(Self::Autonomous),
            Some(&b'D') => Some(Self::Differential),
            Some(&b'E') => Some(Self::Estimated),
            Some(&b'M') => Some(Self::Manual),
            Some(&b'S') => Some(Self::Simulator),
            Some(&b'N') => Some(Self::Invalid),
            Some(&b'F') => Some(Self::RtkFloat),
            Some(&b'R') => Some(Self::RtkFixed),
            Some(&b'P') => Some(Self::Precise),
            _ => None,
        }
    }
}