pub enum ParseState {
Continue,
DataReady,
CrcError,
HighPayloadError,
StopByteError,
COBSError,
}Expand description
Shows the progress/error when parsing bytes with SerMsg.parse_read_bytes().
§Example
use serialmessage::{SerMsg, ParseState};
let rcvd_message_vec: Vec<u8> = vec![126, 1, 0, 4, 0, 72, 105, 33, 246, 129];
let mut ser_msg = SerMsg::new();
let (parse_state, _parsed_bytes) = ser_msg.parse_read_bytes(&rcvd_message_vec);
match parse_state {
ParseState::DataReady => {
// Do something with the received data
}
// No error occurred, but no complete message is ready
ParseState::Continue => (),
// Handle or ignore these error
ParseState::CrcError => (),
ParseState::HighPayloadError => (),
ParseState::StopByteError => (),
ParseState::COBSError => (),
}Variants§
Continue
The bytes were handled successfully, but no complete message is ready
DataReady
The complete message was parsed successfully and the data is ready
CrcError
The CrcCheck failed, the message is most likely corrupted
HighPayloadError
The Payload length exceeded its maximum of 254
StopByteError
The StopByte was not found after the CrcCheck
COBSError
Couldn’t successfully unpack the Consistent Overhead Byte Stuffing
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ParseState
impl RefUnwindSafe for ParseState
impl Send for ParseState
impl Sync for ParseState
impl Unpin for ParseState
impl UnwindSafe for ParseState
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