pub struct MessageView<'a> { /* private fields */ }Expand description
Zero-copy view into a complete SOME/IP message (header + payload).
Implementations§
Source§impl<'a> MessageView<'a>
impl<'a> MessageView<'a>
Sourcepub fn parse(buf: &'a [u8]) -> Result<Self, Error>
pub fn parse(buf: &'a [u8]) -> Result<Self, Error>
Parse a complete SOME/IP message from buf.
Validates the header, checks that the buffer contains enough data for the declared payload, and for SD messages validates SD-specific constraints.
§Errors
Returns an error if the header is invalid, the buffer is too short for the declared payload, or SD-specific validation fails.
Sourcepub fn header(&self) -> HeaderView<'a>
pub fn header(&self) -> HeaderView<'a>
Returns the header view.
Sourcepub fn payload_bytes(&self) -> &'a [u8] ⓘ
pub fn payload_bytes(&self) -> &'a [u8] ⓘ
Returns the raw payload bytes.
Sourcepub fn sd_header(&self) -> Result<SdHeaderView<'a>, Error>
pub fn sd_header(&self) -> Result<SdHeaderView<'a>, Error>
Parse the payload as an SD header.
The caller should check is_sd() first; this method returns an error
if the message is not an SD message (the SD validation in parse must
have already passed).
§Errors
Returns an error if this is not an SD message or the SD payload is malformed.
Trait Implementations§
Source§impl<'a> Clone for MessageView<'a>
impl<'a> Clone for MessageView<'a>
Source§fn clone(&self) -> MessageView<'a>
fn clone(&self) -> MessageView<'a>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<'a> Debug for MessageView<'a>
impl<'a> Debug for MessageView<'a>
impl<'a> Copy for MessageView<'a>
Auto Trait Implementations§
impl<'a> Freeze for MessageView<'a>
impl<'a> RefUnwindSafe for MessageView<'a>
impl<'a> Send for MessageView<'a>
impl<'a> Sync for MessageView<'a>
impl<'a> Unpin for MessageView<'a>
impl<'a> UnsafeUnpin for MessageView<'a>
impl<'a> UnwindSafe for MessageView<'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