N2kMessage

Struct N2kMessage 

Source
pub struct N2kMessage {
    pub header: N2kHeader,
    pub len: usize,
    pub body: [u8; 8],
}
Expand description

An N2kMessage has a header and a body. The header is encoded into a 32-bit header field for a CAN-frame. The body is a sequence of up to 8 bytes. Longer messages need to be split into multiple CAN-frames with a counter at the start of each body. The life-time of an N2kMessage is coupled to the liftime of its underlying data sequence.

Fields§

§header: N2kHeader§len: usize§body: [u8; 8]

Implementations§

Source§

impl N2kMessage

Source

pub fn new(header: N2kHeader, body: &[u8]) -> N2kMessage

create an N2kMessage

Source

pub fn get_header(&self) -> N2kHeader

Source

pub fn get_body(&self) -> &[u8]

Auto Trait Implementations§

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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>,

Source§

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.