CANRead

Trait CANRead 

Source
pub trait CANRead {
    // Required methods
    fn data(&self) -> &[u8] ;
    fn dlc(&self) -> usize;
}
Expand description

A trait providing methods for accessing the underlying bytes of some CAN-bus data.

Required Methods§

Source

fn data(&self) -> &[u8]

Returns a slice representing the accessible bytes.

Source

fn dlc(&self) -> usize

Returns the number of accessible bytes.

Implementations on Foreign Types§

Source§

impl CANRead for &[u8]

Source§

fn data(&self) -> &[u8]

use cantools::data::CANRead;
let v : [u8; 0] = [];
assert_eq!(CANRead::data(&v), &[]);
Source§

fn dlc(&self) -> usize

§Example
use cantools::data::CANRead;
let v : [u8; 0] = [];
assert_eq!(CANRead::dlc(&v), 0);
Source§

impl CANRead for &mut [u8]

Source§

fn data(&self) -> &[u8]

Source§

fn dlc(&self) -> usize

Source§

impl CANRead for Vec<u8>

Source§

fn data(&self) -> &[u8]

§Example
use cantools::data::CANRead;
let v = Vec::<u8>::new();
assert_eq!(CANRead::data(&v), &[]);
Source§

fn dlc(&self) -> usize

§Example
use cantools::data::CANRead;
let v = Vec::<u8>::new();
assert_eq!(CANRead::dlc(&v), 0);
Source§

impl<const N: usize> CANRead for [u8; N]

Source§

fn data(&self) -> &[u8]

Source§

fn dlc(&self) -> usize

Implementors§