Error

Enum Error 

Source
pub enum Error<I, E> {
    NonAscii,
    ChecksumMismatch {
        expected: u8,
        found: u8,
    },
    ParsingError(E),
    UnrecognizedMessage(I),
    InvalidField(I),
    Unknown,
}
Expand description

Represents all possible errors that can occur during NMEA message parsing.

This enum covers various failure modes including input validation, checksum verification, and parsing errors.

Variants§

§

NonAscii

The provided input contains non-ASCII characters.

NMEA messages must be ASCII-only for proper parsing and checksum calculation.

§

ChecksumMismatch

The checksum of the sentence was corrupt or incorrect.

Contains both the expected checksum (calculated from the message content) and the actual checksum found in the message.

Fields

§expected: u8

The checksum calculated from the message content

§found: u8

The checksum found in the message

§

ParsingError(E)

The sentence could not be parsed because its format was invalid.

This wraps nom’s standard parsing errors and provides context about what went wrong during parsing.

§

UnrecognizedMessage(I)

The message type is not recognized by the parser.

This variant is used when a valid NMEA sentence is encountered, but the parser does not implement handling for this specific message type. The message type that caused the error is provided for reference.

§

InvalidField(I)

A field in the NMEA sentence was invalid.

This error occurs when a specific field in the NMEA sentence does not conform to the expected format, type, or value range.

Contains the input that caused the error.

§

Unknown

An unknown error occurred.

This is a catch-all for unexpected error conditions.

Trait Implementations§

Source§

impl<I: Debug, E: Debug> Debug for Error<I, E>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<I, E, EX> FromExternalError<I, EX> for Error<I, E>
where E: FromExternalError<I, EX>,

Source§

fn from_external_error(input: I, kind: ErrorKind, e: EX) -> Self

Creates a new error from an input position, an ErrorKind indicating the wrapping parser, and an external error
Source§

impl<I, E> ParseError<I> for Error<I, E>
where E: ParseError<I>,

Source§

fn from_error_kind(input: I, kind: ErrorKind) -> Self

Creates an error from the input position and an ErrorKind
Source§

fn append(_: I, _: ErrorKind, other: Self) -> Self

Combines an existing error with a new one created from the input position and an ErrorKind. This is useful when backtracking through a parse tree, accumulating error context on the way
Source§

fn from_char(input: I, _: char) -> Self

Creates an error from an input position and an expected character
Source§

fn or(self, other: Self) -> Self

Combines two existing errors. This function is used to compare errors generated in various branches of alt.
Source§

impl<I: PartialEq, E: PartialEq> PartialEq for Error<I, E>

Source§

fn eq(&self, other: &Error<I, E>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<I, E> StructuralPartialEq for Error<I, E>

Auto Trait Implementations§

§

impl<I, E> Freeze for Error<I, E>
where E: Freeze, I: Freeze,

§

impl<I, E> RefUnwindSafe for Error<I, E>

§

impl<I, E> Send for Error<I, E>
where E: Send, I: Send,

§

impl<I, E> Sync for Error<I, E>
where E: Sync, I: Sync,

§

impl<I, E> Unpin for Error<I, E>
where E: Unpin, I: Unpin,

§

impl<I, E> UnwindSafe for Error<I, E>
where E: UnwindSafe, I: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.