pub struct CanDataFrame(/* private fields */);
Expand description

The classic CAN 2.0 frame with up to 8-bytes of data.

This is highly compatible with the can_frame from libc. (ref)

Trait Implementations§

source§

impl AsPtr for CanDataFrame

source§

fn as_ptr(&self) -> *const Self::Inner

Gets a pointer to the CAN frame structure that is compatible with the Linux C API.

source§

fn as_mut_ptr(&mut self) -> *mut Self::Inner

Gets a mutable pointer to the CAN frame structure that is compatible with the Linux C API.

§

type Inner = can_frame

The inner type to which we resolve as a pointer
source§

fn size(&self) -> usize

The size of the inner type
source§

impl AsRef<can_frame> for CanDataFrame

source§

fn as_ref(&self) -> &can_frame

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

impl Clone for CanDataFrame

source§

fn clone(&self) -> CanDataFrame

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 CanDataFrame

source§

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

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

impl Default for CanDataFrame

source§

fn default() -> Self

The default FD frame has all fields and data set to zero, and all flags off.

source§

impl Frame for CanDataFrame

source§

fn id_word(&self) -> canid_t

Get the composite SocketCAN ID word, with EFF/RTR/ERR flags

source§

fn set_id(&mut self, id: impl Into<Id>)

Sets the CAN ID for the frame

source§

fn set_data(&mut self, data: &[u8]) -> Result<(), ConstructionError>

Sets the data payload of the frame.

source§

fn from_raw_id(id: u32, data: &[u8]) -> Option<Self>

Creates a frame using a raw, integer CAN ID. Read more
source§

fn remote_from_raw_id(id: u32, dlc: usize) -> Option<Self>

Creates a remote frame using a raw, integer CAN ID. Read more
source§

fn raw_id(&self) -> canid_t

Return the actual raw CAN ID (without EFF/RTR/ERR flags)
source§

fn id_flags(&self) -> IdFlags

Returns the EFF/RTR/ERR flags from the ID word
source§

fn hal_id(&self) -> Id

Return the CAN ID as the embedded HAL Id type.
source§

fn len(&self) -> usize

Get the data length
source§

fn is_error_frame(&self) -> bool

Check if frame is an error message
source§

impl Frame for CanDataFrame

source§

fn new(id: impl Into<Id>, data: &[u8]) -> Option<Self>

Create a new CAN 2.0 data frame

source§

fn new_remote(_id: impl Into<Id>, _dlc: usize) -> Option<Self>

Create a new remote transmission request frame.

source§

fn is_extended(&self) -> bool

Check if frame uses 29-bit extended ID format.

source§

fn is_remote_frame(&self) -> bool

Check if frame is a remote transmission request.

source§

fn id(&self) -> Id

Return the frame identifier.

source§

fn dlc(&self) -> usize

Data length

source§

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

A slice into the actual data. Slice will always be <= 8 bytes in length

source§

fn is_standard(&self) -> bool

Returns true if this frame is a standard frame.
source§

fn is_data_frame(&self) -> bool

Returns true if this frame is a data frame.
source§

impl From<CanDataFrame> for CanFdFrame

source§

fn from(frame: CanDataFrame) -> Self

Converts to this type from the input type.
source§

impl From<CanDataFrame> for CanFrame

source§

fn from(frame: CanDataFrame) -> Self

Create a CanFrame from a data frame

source§

impl TryFrom<CanFdFrame> for CanDataFrame

§

type Error = ConstructionError

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

fn try_from(frame: CanFdFrame) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<can_frame> for CanDataFrame

source§

fn try_from(frame: can_frame) -> Result<Self, Self::Error>

Try to create a CanDataFrame from a C can_frame

This will succeed as long as the C frame is not marked as an error or remote frame.

§

type Error = ConstructionError

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

impl UpperHex for CanDataFrame

source§

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

Formats the value using the given formatter.
source§

impl Copy for CanDataFrame

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> ControllerSpecificErrorInformation for Twhere T: Frame,

source§

fn get_ctrl_err(&self) -> Option<&[u8]>

Get the controller specific error information.

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere 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 Twhere 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 Twhere 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 Twhere 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.