pub enum CanFrame {
Data(CanDataFrame),
Remote(CanRemoteFrame),
Error(CanErrorFrame),
}
Expand description
The classic CAN 2.0 frame with up to 8-bytes of data.
Variants§
Data(CanDataFrame)
A data frame
Remote(CanRemoteFrame)
A remote frame
Error(CanErrorFrame)
An error frame
Trait Implementations§
source§impl AsPtr for CanFrame
impl AsPtr for CanFrame
source§impl Frame for CanFrame
impl Frame for CanFrame
source§fn new_remote(id: impl Into<Id>, dlc: usize) -> Option<Self>
fn new_remote(id: impl Into<Id>, dlc: usize) -> Option<Self>
Create a new remote transmission request frame.
source§fn is_extended(&self) -> bool
fn is_extended(&self) -> bool
Check if frame uses 29-bit extended ID format.
source§fn is_remote_frame(&self) -> bool
fn is_remote_frame(&self) -> bool
Check if frame is a remote transmission request.
source§fn data(&self) -> &[u8] ⓘ
fn data(&self) -> &[u8] ⓘ
A slice into the actual data. Slice will always be <= 8 bytes in length
source§fn is_standard(&self) -> bool
fn is_standard(&self) -> bool
Returns true if this frame is a standard frame.
source§fn is_data_frame(&self) -> bool
fn is_data_frame(&self) -> bool
Returns true if this frame is a data frame.
source§impl Frame for CanFrame
impl Frame for CanFrame
source§fn set_data(&mut self, data: &[u8]) -> Result<(), ConstructionError>
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>
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>
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 is_error_frame(&self) -> bool
fn is_error_frame(&self) -> bool
Check if frame is an error message
source§impl From<CanDataFrame> for CanFrame
impl From<CanDataFrame> for CanFrame
source§fn from(frame: CanDataFrame) -> Self
fn from(frame: CanDataFrame) -> Self
Create a CanFrame
from a data frame
source§impl From<CanErrorFrame> for CanFrame
impl From<CanErrorFrame> for CanFrame
source§fn from(frame: CanErrorFrame) -> Self
fn from(frame: CanErrorFrame) -> Self
Create a CanFrame
from an error frame
source§impl From<CanFrame> for CanAnyFrame
impl From<CanFrame> for CanAnyFrame
source§impl From<CanRemoteFrame> for CanFrame
impl From<CanRemoteFrame> for CanFrame
source§fn from(frame: CanRemoteFrame) -> Self
fn from(frame: CanRemoteFrame) -> Self
Create a CanFrame
from a remote frame
source§impl TryFrom<CanFdFrame> for CanFrame
impl TryFrom<CanFdFrame> for CanFrame
source§fn try_from(
frame: CanFdFrame
) -> Result<Self, <Self as TryFrom<CanFdFrame>>::Error>
fn try_from( frame: CanFdFrame ) -> Result<Self, <Self as TryFrom<CanFdFrame>>::Error>
Try to convert a CAN FD frame into a classic CAN 2.0 frame.
This should work if it’s a data frame with 8 or fewer data bytes.
§type Error = ConstructionError
type Error = ConstructionError
The type returned in the event of a conversion error.
impl Copy for CanFrame
Auto Trait Implementations§
impl RefUnwindSafe for CanFrame
impl Send for CanFrame
impl Sync for CanFrame
impl Unpin for CanFrame
impl UnwindSafe for CanFrame
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> ControllerSpecificErrorInformation for Twhere
T: Frame,
impl<T> ControllerSpecificErrorInformation for Twhere T: Frame,
source§fn get_ctrl_err(&self) -> Option<&[u8]>
fn get_ctrl_err(&self) -> Option<&[u8]>
Get the controller specific error information.