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 more