Struct fdcanusb::CanFdFrame

source ·
pub struct CanFdFrame {
    pub arbitration_id: u16,
    pub data: Vec<u8>,
    pub extended_id: Option<bool>,
    pub brs: Option<bool>,
    pub fd_can_frame: Option<bool>,
    pub remote_frame: Option<bool>,
    pub timestamp: Option<u32>,
}
Expand description

CanFdFrame represents a single frame of data on the CAN bus.

Fields§

§arbitration_id: u16

The arbitration id of the frame.

§data: Vec<u8>

The data of the frame, up to 64 bytes.

§extended_id: Option<bool>

If the frame has an extended id.

§brs: Option<bool>

If the frame has bit rate switching.

§fd_can_frame: Option<bool>

If the frame is a CAN FD frame.

§remote_frame: Option<bool>

If the frame is a remote frame.

§timestamp: Option<u32>

The timestamp of the frame.

Implementations§

source§

impl CanFdFrame

source

pub fn new(arbitration_id: u16, data: &[u8]) -> Result<CanFdFrame>

Create a new CanFdFrame with the given arbitration id and data. returns an Err if the length of data is > 64

Use CanFdFrame::new_with_flags to set the flags.

source

pub fn new_with_flags( arbitration_id: u16, data: &[u8], extended_id: Option<bool>, brs: Option<bool>, fd_can_frame: Option<bool>, remote_frame: Option<bool>, timestamp: Option<u32>, ) -> Result<CanFdFrame>

Create a new CanFdFrame with the given arbitration id, data and flags. returns an Err if the length of data is > 64

Trait Implementations§

source§

impl Debug for CanFdFrame

source§

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

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

impl Default for CanFdFrame

source§

fn default() -> CanFdFrame

Returns the “default value” for a type. Read more
source§

impl From<CanFdFrame> for FdCanUSBFrame

source§

fn from(frame: CanFdFrame) -> FdCanUSBFrame

Converts to this type from the input type.
source§

impl TryFrom<FdCanUSBFrame> for CanFdFrame

§

type Error = Error

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

fn try_from(data: FdCanUSBFrame) -> Result<Self, Self::Error>

Performs the conversion.

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

§

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.