pub struct MessagePack<'a> { /* private fields */ }Expand description
A borrowed, structurally checked message pack.
MessagePack::parse applies the same rules as the reference library:
the single message size must be 25, the pack must hold 1 to 9 messages,
it may contain no nested packs or unknown types, and at most one Location,
Self ID, System and Operator ID message. Individual messages are decoded
lazily by MessagePack::messages.
Implementations§
Source§impl<'a> MessagePack<'a>
impl<'a> MessagePack<'a>
Sourcepub fn parse(data: &'a [u8]) -> Result<Self, Error>
pub fn parse(data: &'a [u8]) -> Result<Self, Error>
Parses a pack that starts at data[0] (the pack header byte).
Bytes after the last message are ignored.
Sourcepub fn protocol_version(&self) -> u8
pub fn protocol_version(&self) -> u8
Protocol version from the pack header.
Sourcepub fn encoded_len(&self) -> usize
pub fn encoded_len(&self) -> usize
Size of the encoded pack in bytes, header included.
Sourcepub fn raw_messages(&self) -> impl Iterator<Item = &'a [u8; 25]> + 'a
pub fn raw_messages(&self) -> impl Iterator<Item = &'a [u8; 25]> + 'a
The raw 25 byte messages.
Trait Implementations§
Source§impl<'a> Clone for MessagePack<'a>
impl<'a> Clone for MessagePack<'a>
impl<'a> Copy for MessagePack<'a>
Source§impl<'a> Debug for MessagePack<'a>
impl<'a> Debug for MessagePack<'a>
impl<'a> Eq for MessagePack<'a>
Source§impl<'a> PartialEq for MessagePack<'a>
impl<'a> PartialEq for MessagePack<'a>
impl<'a> StructuralPartialEq for MessagePack<'a>
Auto Trait Implementations§
impl<'a> Forget for MessagePack<'a>
impl<'a> Freeze for MessagePack<'a>
impl<'a> Move for MessagePack<'a>
impl<'a> RefUnwindSafe for MessagePack<'a>
impl<'a> Send for MessagePack<'a>
impl<'a> Sync for MessagePack<'a>
impl<'a> Unpin for MessagePack<'a>
impl<'a> UnsafeUnpin for MessagePack<'a>
impl<'a> UnwindSafe for MessagePack<'a>
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