Struct xsens_mti::prelude::Frame[][src]

pub struct Frame<T: AsRef<[u8]>> { /* fields omitted */ }

Implementations

impl<T: AsRef<[u8]>> Frame<T>[src]

pub const PREAMBLE: u8[src]

pub const STD_LEN_IS_EXT: u8[src]

pub const HEADER_SIZE: usize[src]

pub const EXT_HEADER_SIZE: usize[src]

pub const PREAMBLE_SIZE: usize[src]

pub const EXT_LEN_SIZE: usize[src]

pub const CHECKSUM_SIZE: usize[src]

pub const MAX_FRAME_SIZE: usize[src]

pub fn new_unchecked(buffer: T) -> Frame<T>[src]

pub fn new(buffer: T) -> Result<Frame<T>, FrameError>[src]

pub fn check_len(&self) -> Result<(), FrameError>[src]

pub fn check_preamble(&self) -> Result<(), FrameError>[src]

pub fn check_payload_length(&self) -> Result<(), FrameError>[src]

pub fn check_checksum(&self) -> Result<(), FrameError>[src]

pub fn into_inner(self) -> T[src]

pub fn header_len() -> usize[src]

Return the length of a message header.

Does not include extended length, payload or checksum byte.

pub fn buffer_len(n_payload_bytes: usize) -> usize[src]

Return the length of a buffer required to hold a message with a payload length of n_payload_bytes + CHECKSUM_SIZE.

pub fn preamble(&self) -> u8[src]

pub fn bus_id(&self) -> BusId[src]

pub fn message_id(&self) -> MessageId[src]

pub fn payload_length(&self) -> Result<PayloadLength, FrameError>[src]

pub fn checksum(&self) -> Result<u8, FrameError>[src]

pub fn compute_checksum(&self) -> Result<u8, FrameError>[src]

Sum of all bytes excluding the preamble

impl<'a, T: AsRef<[u8]> + ?Sized> Frame<&'a T>[src]

pub fn payload(&self) -> Result<&'a [u8], FrameError>[src]

Return a pointer to the payload.

Does not include the checksum byte.

impl<T: AsRef<[u8]> + AsMut<[u8]>> Frame<T>[src]

pub fn set_preamble(&mut self)[src]

pub fn set_bus_id(&mut self, value: BusId)[src]

pub fn set_message_id(&mut self, value: MessageId)[src]

pub fn set_payload_length(&mut self, value: PayloadLength)[src]

pub fn payload_mut(&mut self) -> Result<&mut [u8], FrameError>[src]

Return a mutable pointer to the payload.

Does not include the checksum byte.

pub fn set_checksum(&mut self, value: u8) -> Result<(), FrameError>[src]

Trait Implementations

impl<T: AsRef<[u8]>> AsRef<[u8]> for Frame<T>[src]

fn as_ref(&self) -> &[u8][src]

Performs the conversion.

impl<T: Clone + AsRef<[u8]>> Clone for Frame<T>[src]

fn clone(&self) -> Frame<T>[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<T: Debug + AsRef<[u8]>> Debug for Frame<T>[src]

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

Formats the value using the given formatter. Read more

impl<T: AsRef<[u8]>> Display for Frame<T>[src]

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

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl<T> Send for Frame<T> where
    T: Send

impl<T> Sync for Frame<T> where
    T: Sync

impl<T> Unpin for Frame<T> where
    T: Unpin

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

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

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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

Performs the conversion.