Thanks to visit codestin.com
Credit goes to docs.rs

Frame

Trait Frame 

Source
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§

Source

fn id_word(&self) -> canid_t

Get the composite SocketCAN ID word, with EFF/RTR/ERR flags

Source

fn set_id(&mut self, id: impl Into<Id>)

Sets the CAN ID for the frame

Source

fn set_data(&mut self, data: &[u8]) -> Result<(), ConstructionError>

Sets the data payload of the frame.

Provided Methods§

Source

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().

Source

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().

Source

fn raw_id(&self) -> canid_t

Return the actual raw CAN ID (without EFF/RTR/ERR flags)

Source

fn id_flags(&self) -> IdFlags

Returns the EFF/RTR/ERR flags from the ID word

Source

fn can_id(&self) -> CanId

Return the CAN ID.

Source

fn hal_id(&self) -> Id

Return the CAN ID as the embedded HAL Id type.

Source

fn len(&self) -> usize

Get the data length

Source

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.

Implementors§