pub struct SerMsg { /* private fields */ }Expand description
Struct that implements all the functionality of this crate
Implementations§
Source§impl SerMsg
impl SerMsg
Sourcepub fn return_read_data(&self) -> &[u8]
pub fn return_read_data(&self) -> &[u8]
Returns the data of the parsed message, should only be used after the ParseState is DataReady
Sourcepub fn return_msg_id(&self) -> u8
pub fn return_msg_id(&self) -> u8
Returns the id of the parsed message, should only be used after the ParseState is DataReady
Sourcepub fn create_msg_arr(data: &[u8], id: u8) -> Option<([u8; 260], usize)>
pub fn create_msg_arr(data: &[u8], id: u8) -> Option<([u8; 260], usize)>
no_std function to create a message. Packs the slice into the message format and returns an array with a fixed length of the maximum message size and the last index of the relevant bytes in the array. Returns None if the input slice exceeds the maximum supported length of 254 bytes.
Sourcepub fn parse_read_bytes(&mut self, arr: &[u8]) -> (ParseState, usize)
pub fn parse_read_bytes(&mut self, arr: &[u8]) -> (ParseState, usize)
Parses the bytes of the input slice. Returns a ParseState and the amount of bytes parsed when an error occured, a complete message was parsed or when all bytes were read.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SerMsg
impl RefUnwindSafe for SerMsg
impl Send for SerMsg
impl Sync for SerMsg
impl Unpin for SerMsg
impl UnwindSafe for SerMsg
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