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>

source

pub fn from_slice( slice: &'a [u8] ) -> Result<DltPacketSlice<'_>, PacketSliceError>

Read the dlt header and create a slice containing the dlt header & payload.

source

pub fn has_extended_header(&self) -> bool

Returns if an extended header is present.

source

pub fn is_big_endian(&self) -> bool

Returns if the numbers in the payload are encoded in big endian.

source

pub fn is_verbose(&self) -> bool

Returns if the dlt package is verbose or non verbose.

source

pub fn extended_header(&self) -> Option<DltExtendedHeader>

Returns the dlt extended header if present

source

pub fn message_type(&self) -> Option<DltMessageType>

Returns the message type if a parsable message type is present

source

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.

source

pub fn slice(&self) -> &'a [u8]

Returns the slice containing the dlt header + payload.

source

pub fn payload(&self) -> &'a [u8]

Returns a slice containing the payload of the dlt message

source

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.

source

pub fn non_verbose_payload(&self) -> Option<&'a [u8]>

Returns a slice containing the payload of a non verbose message (after the message id).

source

pub fn verbose_value_iter(&self) -> Option<VerboseIter<'a>>

Returns a iterator over the verbose values (if the dlt message is a verbose message).

source

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).

source

pub fn header(&self) -> DltHeader

Deserialize the dlt header

Trait Implementations§

source§

impl<'a> Clone for DltPacketSlice<'a>

source§

fn clone(&self) -> DltPacketSlice<'a>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<'a> Debug for DltPacketSlice<'a>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a> PartialEq for DltPacketSlice<'a>

source§

fn eq(&self, other: &DltPacketSlice<'a>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a> Eq for DltPacketSlice<'a>

source§

impl<'a> StructuralPartialEq for DltPacketSlice<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for DltPacketSlice<'a>

§

impl<'a> RefUnwindSafe for DltPacketSlice<'a>

§

impl<'a> Send for DltPacketSlice<'a>

§

impl<'a> Sync for DltPacketSlice<'a>

§

impl<'a> Unpin for DltPacketSlice<'a>

§

impl<'a> UnwindSafe for DltPacketSlice<'a>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.