Struct embedded_hal_mock::I2cMock [−][src]
pub struct I2cMock<'a> { /* fields omitted */ }Methods
impl<'a> I2cMock<'a>[src]
impl<'a> I2cMock<'a>pub fn new() -> Self[src]
pub fn new() -> Selfpub fn set_read_data(&mut self, data: &'a [u8])[src]
pub fn set_read_data(&mut self, data: &'a [u8])Set data that will be read by read().
pub fn get_write_data(&self) -> &[u8][src]
pub fn get_write_data(&self) -> &[u8]Return the data that was written by the last write command.
pub fn get_last_address(&self) -> Option<u8>[src]
pub fn get_last_address(&self) -> Option<u8>Return the address that was used by the last read or write command.
Trait Implementations
impl<'a> Read for I2cMock<'a>[src]
impl<'a> Read for I2cMock<'a>type Error = MockError
Error type
fn read(&mut self, address: u8, buffer: &mut [u8]) -> Result<(), Self::Error>[src]
fn read(&mut self, address: u8, buffer: &mut [u8]) -> Result<(), Self::Error>Reads enough bytes from slave with address to fill buffer Read more
impl<'a> Write for I2cMock<'a>[src]
impl<'a> Write for I2cMock<'a>type Error = MockError
Error type
fn write(&mut self, address: u8, bytes: &[u8]) -> Result<(), Self::Error>[src]
fn write(&mut self, address: u8, bytes: &[u8]) -> Result<(), Self::Error>Sends bytes to slave with address addr Read more
impl<'a> WriteRead for I2cMock<'a>[src]
impl<'a> WriteRead for I2cMock<'a>