#[non_exhaustive]pub enum SbfError {
InvalidSync,
CrcMismatch {
expected: u16,
actual: u16,
},
IncompleteBlock {
needed: usize,
have: usize,
},
InvalidLength(u16),
ParseError(String),
Io(Error),
WouldBlock,
}Expand description
Errors that can occur during SBF parsing
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
InvalidSync
Invalid sync bytes (expected 0x24 0x40)
CrcMismatch
CRC checksum mismatch
IncompleteBlock
Block is incomplete (not enough data)
InvalidLength(u16)
Invalid block length (must be >= 8 and divisible by 4)
ParseError(String)
Block-specific parsing error
Io(Error)
I/O error during reading
WouldBlock
No complete block is available yet, but the stream has not ended.
Returned by SbfReader::read_block when a
non-blocking source (for example a serial port in non-blocking mode) has
no data available right now. This is distinct from end of stream: EOF is
reported as Ok(None), whereas WouldBlock means the caller should retry
later. Blocking sources (files, Cursor) never produce this.
Trait Implementations§
Source§impl Error for SbfError
impl Error for SbfError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Auto Trait Implementations§
impl !RefUnwindSafe for SbfError
impl !UnwindSafe for SbfError
impl Freeze for SbfError
impl Send for SbfError
impl Sync for SbfError
impl Unpin for SbfError
impl UnsafeUnpin for SbfError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more