Struct dlt_parse::DltPacketSlice
source · pub struct DltPacketSlice<'a> { /* private fields */ }
Expand description
A slice containing an dlt header & payload.
Implementations§
source§impl<'a> DltPacketSlice<'a>
impl<'a> DltPacketSlice<'a>
sourcepub fn from_slice(
slice: &'a [u8]
) -> Result<DltPacketSlice<'_>, PacketSliceError>
pub fn from_slice( slice: &'a [u8] ) -> Result<DltPacketSlice<'_>, PacketSliceError>
Read the dlt header and create a slice containing the dlt header & payload.
sourcepub fn has_extended_header(&self) -> bool
pub fn has_extended_header(&self) -> bool
Returns if an extended header is present.
sourcepub fn is_big_endian(&self) -> bool
pub fn is_big_endian(&self) -> bool
Returns if the numbers in the payload are encoded in big endian.
sourcepub fn is_verbose(&self) -> bool
pub fn is_verbose(&self) -> bool
Returns if the dlt package is verbose or non verbose.
sourcepub fn extended_header(&self) -> Option<DltExtendedHeader>
pub fn extended_header(&self) -> Option<DltExtendedHeader>
Returns the dlt extended header if present
sourcepub fn message_type(&self) -> Option<DltMessageType>
pub fn message_type(&self) -> Option<DltMessageType>
Returns the message type if a parsable message type is present
sourcepub fn message_id(&self) -> Option<u32>
pub fn message_id(&self) -> Option<u32>
Returns the message id if the message is a non verbose message and enough data for a message is present. Otherwise None is returned.
sourcepub fn message_id_and_payload(&self) -> Option<(u32, &'a [u8])>
pub fn message_id_and_payload(&self) -> Option<(u32, &'a [u8])>
Returns the message id and a slice containing the payload (after the message id) if the dlt message is a non verbose message.
If the message is not a non verbose message or does not have enough
memory for the message id None
is returned.
sourcepub fn non_verbose_payload(&self) -> Option<&'a [u8]>
pub fn non_verbose_payload(&self) -> Option<&'a [u8]>
Returns a slice containing the payload of a non verbose message (after the message id).
sourcepub fn verbose_value_iter(&self) -> Option<VerboseIter<'a>>
pub fn verbose_value_iter(&self) -> Option<VerboseIter<'a>>
Returns a iterator over the verbose values (if the dlt message is a verbose message).
sourcepub fn typed_payload(&self) -> Result<DltTypedPayload<'a>, TypedPayloadError>
pub fn typed_payload(&self) -> Result<DltTypedPayload<'a>, TypedPayloadError>
Returns the verbose or non verbose payload of the given dlt message (if it has one).
Trait Implementations§
source§impl<'a> Clone for DltPacketSlice<'a>
impl<'a> Clone for DltPacketSlice<'a>
source§fn clone(&self) -> DltPacketSlice<'a>
fn clone(&self) -> DltPacketSlice<'a>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<'a> Debug for DltPacketSlice<'a>
impl<'a> Debug for DltPacketSlice<'a>
source§impl<'a> PartialEq for DltPacketSlice<'a>
impl<'a> PartialEq for DltPacketSlice<'a>
source§fn eq(&self, other: &DltPacketSlice<'a>) -> bool
fn eq(&self, other: &DltPacketSlice<'a>) -> bool
self
and other
values to be equal, and is used
by ==
.