pub trait Frame: EmbeddedFrame {
// Required methods
fn id_word(&self) -> canid_t;
fn set_id(&mut self, id: impl Into<Id>);
fn set_data(&mut self, data: &[u8]) -> Result<(), ConstructionError>;
// Provided methods
fn from_raw_id(id: u32, data: &[u8]) -> Option<Self> { ... }
fn remote_from_raw_id(id: u32, dlc: usize) -> Option<Self> { ... }
fn raw_id(&self) -> canid_t { ... }
fn id_flags(&self) -> IdFlags { ... }
fn hal_id(&self) -> Id { ... }
fn len(&self) -> usize { ... }
fn is_error_frame(&self) -> bool { ... }
}
Expand description
Shared trait for CAN frames
Required Methods§
Provided Methods§
sourcefn 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.
If the id
is <= 0x7FF, it’s assumed to be a standard ID, otherwise
it is created as an Extened ID. If you require an Etended ID <= 0x7FF,
use new()
.
sourcefn 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.
If the id
is <= 0x7FF, it’s assumed to be a standard ID, otherwise
it is created as an Extened ID. If you require an Etended ID <= 0x7FF,
use new_remote()
.
sourcefn is_error_frame(&self) -> bool
fn is_error_frame(&self) -> bool
Check if frame is an error message
Object Safety§
This trait is not object safe.