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 can_id(&self) -> CanId { ... }
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 Extended ID. If you require an Extended 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 Extended ID. If you require an Extended ID <= 0x7FF,
use new_remote()
.
Sourcefn is_error_frame(&self) -> bool
fn is_error_frame(&self) -> bool
Check if frame is an error message
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.