Struct j1939::Frame

source ·
pub struct Frame { /* private fields */ }
Expand description

Data frame.

Implementations§

source§

impl Frame

source

pub fn new(id: Id, pdu: [u8; 8]) -> Self

Construct a new frame.

§Arguments
  • id - The ID of the frame.
  • pdu - The Protocol Data Unit (PDU) of the frame.
§Returns

A new Frame instance.

source

pub fn from_raw(id: u32, pdu: [u8; 8]) -> Self

Construct a new frame from raw ID and PDU.

§Arguments
  • id - The raw ID of the frame.
  • pdu - The Protocol Data Unit (PDU) of the frame.
§Returns

A new Frame instance.

source

pub fn id(&self) -> &Id

Get the ID of the frame.

§Returns

A reference to the Id of the frame.

source

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

Returns a slice of the PDU data.

§Returns

A slice of the PDU data.

source

pub fn len(&self) -> usize

Returns the length of the PDU data.

§Returns

The length of the PDU data.

source

pub fn is_empty(&self) -> bool

Returns true if the PDU data is empty.

§Returns

true if the PDU data is empty, false otherwise.

Trait Implementations§

source§

impl AsRef<[u8]> for Frame

source§

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

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl Clone for Frame

source§

fn clone(&self) -> Frame

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 Debug for Frame

source§

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

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

impl Display for Frame

source§

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

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

impl Copy for Frame

Auto Trait Implementations§

§

impl Freeze for Frame

§

impl RefUnwindSafe for Frame

§

impl Send for Frame

§

impl Sync for Frame

§

impl Unpin for Frame

§

impl UnwindSafe for Frame

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

§

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.