pub trait CanFrameExt {
// Required method
fn as_bytes(&self) -> &[u8];
// Provided methods
fn id_word(&self) -> Option<u32> { ... }
fn dlc(&self) -> Option<u8> { ... }
fn data_bytes(&self) -> Option<&[u8]> { ... }
fn is_extended_frame(&self) -> bool { ... }
fn is_rtr(&self) -> bool { ... }
fn is_error_frame(&self) -> bool { ... }
fn can_id(&self) -> Option<Result<CanId, CanError>> { ... }
fn validate(&self) -> Result<(), CanError> { ... }
fn is_valid(&self) -> bool { ... }
fn pci_offset(mode: &AddressMode) -> usize { ... }
fn isotp_bytes(&self, mode: &IsoTpAddressingMode) -> Option<&[u8]> { ... }
}Expand description
Byte layout of a raw classic CAN frame:
[0..=3] - 32-bit CAN ID word (big-endian) bit 31: extended frame flag (EFF) bit 30: remote transmission request (RTR) bit 29: error frame flag (ERR) bits 28-0: CAN ID (11-bit in bits 10-0 for standard, 29-bit in bits 28-0 for extended) [4] - DLC (0–8) [5..=12]- data bytes (0–8 bytes, DLC determines count)
Required Methods§
Provided Methods§
fn id_word(&self) -> Option<u32>
fn dlc(&self) -> Option<u8>
fn data_bytes(&self) -> Option<&[u8]>
fn is_extended_frame(&self) -> bool
fn is_rtr(&self) -> bool
fn is_error_frame(&self) -> bool
fn can_id(&self) -> Option<Result<CanId, CanError>>
fn validate(&self) -> Result<(), CanError>
fn is_valid(&self) -> bool
Sourcefn pci_offset(mode: &AddressMode) -> usize
fn pci_offset(mode: &AddressMode) -> usize
Returns the PCI byte offset given the addressing mode.
Sourcefn isotp_bytes(&self, mode: &IsoTpAddressingMode) -> Option<&[u8]>
fn isotp_bytes(&self, mode: &IsoTpAddressingMode) -> Option<&[u8]>
Returns the data bytes available for ISO-TP PCI + payload given the addressing mode, or None if the frame is too short.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.