rtcm_rs/
rtcm_error.rs

1#[non_exhaustive]
2#[derive(Debug)]
3pub enum RtcmError {
4    NotValid,
5    Incomplete,
6    BufferOverflow,
7    CapacityExceeded,
8    EncodingNotSupported,
9    DuplicateSatellite,
10    InvalidSatelliteId,
11    InvalidSignalId,
12    SatelliteMismatch,
13    DuplicateSatelliteSignal,
14    InvalidSatelliteSignalCount,
15    OutOfRange,
16    InvalidUtf8String,
17}
18
19impl core::fmt::Display for RtcmError {
20    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
21        match self {
22            RtcmError::NotValid => write!(f, "Provided slice does not begin with a valid RTCM message"),
23            RtcmError::Incomplete => write!(f, "Provided slice does not contain a complete RTCM message"),
24            RtcmError::BufferOverflow => write!(f, "Attempted to read or write outside the buffer boundaries"),
25            RtcmError::CapacityExceeded => write!(f, "Attempted to exceed the vector's capacity"),
26            RtcmError::EncodingNotSupported => write!(f, "Attempted to encode empty or corrupt RTCM message"),
27            RtcmError::DuplicateSatellite => write!(f, "The same satellite appears twice in the vector"),
28            RtcmError::InvalidSatelliteId => write!(f, "Satellite ID is outside of its valid range"),
29            RtcmError::InvalidSignalId => write!(f, "Signal ID is not valid"),
30            RtcmError::SatelliteMismatch => write!(f, "Mismatch between the satellites in the satellite data vector and the satellites in the signal data vector"),
31            RtcmError::DuplicateSatelliteSignal => write!(f, "The same satellite-signal combination appears twice in the vector"),
32            RtcmError::InvalidSatelliteSignalCount => write!(f, "The product of total number of satellites and total number of signals exceeds 64 or equals 0"),
33            RtcmError::OutOfRange => write!(f, "Value falls outside of range of valid values"),
34            RtcmError::InvalidUtf8String => write!(f, "String is not valid UTF-8"),
35            //_ => unreachable!(),
36        }
37    }
38}
39
40#[cfg(feature = "std")]
41impl std::error::Error for RtcmError {}