pub struct I2cResponse {
pub read_buf: [u8; 64],
pub length: usize,
}Fields§
§read_buf: [u8; 64]A fixed-size buffer holding the sequence received from the bus participant.
length: usizelength of a message as informed by i2c::read
Implementations§
Source§impl I2cResponse
impl I2cResponse
Sourcepub fn new(read_data: &[u8]) -> I2cResponse
pub fn new(read_data: &[u8]) -> I2cResponse
Creates a new I2cResponse by copying data from a slice.
This constructor is used to package the raw data received from an I2C device into a structured response. It copies the contents of the provided slice into a fixed-size internal buffer.
§Arguments
read_data- A byte slice (&[u8]) containing the data read from the I2C bus. The length of this slice determines thelengthfield of the new struct.
§Returns
A new I2cResponse struct containing the sensor data.
Trait Implementations§
Source§impl Clone for I2cResponse
impl Clone for I2cResponse
Source§fn clone(&self) -> I2cResponse
fn clone(&self) -> I2cResponse
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for I2cResponse
impl Debug for I2cResponse
Auto Trait Implementations§
impl Freeze for I2cResponse
impl RefUnwindSafe for I2cResponse
impl Send for I2cResponse
impl Sync for I2cResponse
impl Unpin for I2cResponse
impl UnwindSafe for I2cResponse
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more