remoteid 0.3.1

Most Remote ID receivers believe whatever the air tells them; this one does not. Drone Remote ID (ASTM F3411-22a, EN 4709-002) in no_std Rust: decode, track, DRIP RFC 9575 signature checks, a spoofed/suspicious/plausible/authenticated verdict for every transmitter, and a CI gate that fails receivers which accept spoofers (open receivers: 0 of 10 spoofers flagged; remoteid: 10 of 10)
Documentation
use core::fmt;

/// Everything that can go wrong while decoding or encoding Remote ID data.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[non_exhaustive]
pub enum Error {
    /// The input ended before the structure did.
    TooShort {
        /// Bytes the structure needs.
        need: usize,
        /// Bytes that were available.
        got: usize,
    },
    /// The header names a message type that the standard does not define.
    UnknownMessageType(u8),
    /// A message of one type was handed to the decoder of another.
    WrongMessageType {
        /// Type the decoder expected.
        expected: u8,
        /// Type found in the header.
        found: u8,
    },
    /// A message pack broke one of its structural rules.
    InvalidPack(&'static str),
    /// An authentication page header is inconsistent.
    InvalidAuthPage(&'static str),
    /// A value is outside the range the field can carry, so it cannot be encoded.
    OutOfRange(&'static str),
    /// The frame is well formed but carries no Remote ID payload.
    NotRemoteId,
    /// The output buffer is too small.
    BufferTooSmall {
        /// Bytes needed.
        need: usize,
        /// Bytes available.
        got: usize,
    },
}

impl fmt::Display for Error {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            Error::TooShort { need, got } => {
                write!(f, "input too short: need {need} bytes, got {got}")
            }
            Error::UnknownMessageType(t) => write!(f, "unknown Remote ID message type {t:#x}"),
            Error::WrongMessageType { expected, found } => {
                write!(f, "expected message type {expected:#x}, found {found:#x}")
            }
            Error::InvalidPack(why) => write!(f, "invalid message pack: {why}"),
            Error::InvalidAuthPage(why) => write!(f, "invalid authentication page: {why}"),
            Error::OutOfRange(field) => write!(f, "value out of range for {field}"),
            Error::NotRemoteId => f.write_str("frame carries no Remote ID payload"),
            Error::BufferTooSmall { need, got } => {
                write!(f, "output buffer too small: need {need} bytes, got {got}")
            }
        }
    }
}

#[cfg(feature = "std")]
impl std::error::Error for Error {}