pub trait Frame: Sized {
    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];

    fn is_standard(&self) -> bool { ... }
    fn is_data_frame(&self) -> bool { ... }
}
Expand description

A CAN2.0 Frame

Required Methods

Creates a new frame.

This will return None if the data slice is too long.

Creates a new remote frame (RTR bit set).

This will return None if the data length code (DLC) is not valid.

Returns true if this frame is a extended frame.

Returns true if this frame is a remote frame.

Returns the frame identifier.

Returns the data length code (DLC) which is in the range 0..8.

For data frames the DLC value always matches the length of the data. Remote frames do not carry any data, yet the DLC can be greater than 0.

Returns the frame data (0..8 bytes in length).

Provided Methods

Returns true if this frame is a standard frame.

Returns true if this frame is a data frame.

Implementors