Trait I2cIter

Source
pub trait I2cIter<A: AddressMode>: I2c<A> {
    // Required method
    fn transaction_iter<'a, O, B>(
        &mut self,
        address: A,
        operations: O,
    ) -> Result<(), Self::Error>
       where O: IntoIterator<Item = Operation<'a, B>>,
             B: IntoIterator<Item = u8>;

    // Provided methods
    fn write_iter<B>(&mut self, address: A, bytes: B) -> Result<(), Self::Error>
       where B: IntoIterator<Item = u8> { ... }
    fn write_iter_read<B>(
        &mut self,
        address: A,
        bytes: B,
        buffer: &mut [u8],
    ) -> Result<(), Self::Error>
       where B: IntoIterator<Item = u8> { ... }
}

Required Methods§

Source

fn transaction_iter<'a, O, B>( &mut self, address: A, operations: O, ) -> Result<(), Self::Error>
where O: IntoIterator<Item = Operation<'a, B>>, B: IntoIterator<Item = u8>,

Execute the provided operations on the I2C bus.

Same as I2c::transaction but with an interator instead of a slice of operations.

Provided Methods§

Source

fn write_iter<B>(&mut self, address: A, bytes: B) -> Result<(), Self::Error>
where B: IntoIterator<Item = u8>,

Writes bytes to slave with address address

Same as I2c::write but with an interator instead of a slice of bytes.

Source

fn write_iter_read<B>( &mut self, address: A, bytes: B, buffer: &mut [u8], ) -> Result<(), Self::Error>
where B: IntoIterator<Item = u8>,

Writes bytes to slave with address address and then reads enough bytes to fill buffer in a single transaction

Same as I2c::write_read but with an interator instead of a slice of bytes.

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§