pub trait Frame: Sized {
// Required methods
fn new(id: impl Into<Id>, data: &[u8]) -> Option<Self>;
fn new_remote(id: impl Into<Id>, dlc: usize) -> Option<Self>;
fn is_extended(&self) -> bool;
fn is_remote_frame(&self) -> bool;
fn id(&self) -> Id;
fn dlc(&self) -> usize;
fn data(&self) -> &[u8];
// Provided methods
fn is_standard(&self) -> bool { ... }
fn is_data_frame(&self) -> bool { ... }
}
Expand description
A CAN2.0 Frame
Required Methods§
Sourcefn new(id: impl Into<Id>, data: &[u8]) -> Option<Self>
fn new(id: impl Into<Id>, data: &[u8]) -> Option<Self>
Creates a new frame.
This will return None
if the data slice is too long.
Sourcefn new_remote(id: impl Into<Id>, dlc: usize) -> Option<Self>
fn new_remote(id: impl Into<Id>, dlc: usize) -> Option<Self>
Creates a new remote frame (RTR bit set).
This will return None
if the data length code (DLC) is not valid.
Sourcefn is_extended(&self) -> bool
fn is_extended(&self) -> bool
Returns true if this frame is a extended frame.
Sourcefn is_remote_frame(&self) -> bool
fn is_remote_frame(&self) -> bool
Returns true if this frame is a remote frame.
Provided Methods§
Sourcefn is_standard(&self) -> bool
fn is_standard(&self) -> bool
Returns true if this frame is a standard frame.
Sourcefn is_data_frame(&self) -> bool
fn is_data_frame(&self) -> bool
Returns true if this frame is a data frame.
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.