Trait AsyncBufferInterface

Source
pub trait AsyncBufferInterface: BufferInterfaceError {
    type AddressType: Copy;

    // Required methods
    async fn write(
        &mut self,
        address: Self::AddressType,
        buf: &[u8],
    ) -> Result<usize, Self::Error>;
    async fn flush(
        &mut self,
        address: Self::AddressType,
    ) -> Result<(), Self::Error>;
    async fn read(
        &mut self,
        address: Self::AddressType,
        buf: &mut [u8],
    ) -> Result<usize, Self::Error>;
}
Expand description

A trait to represent the interface to the device.

This is called to read from and write to buffers.

Required Associated Types§

Source

type AddressType: Copy

The address type used by this interface. Should likely be an integer.

Required Methods§

Source

async fn write( &mut self, address: Self::AddressType, buf: &[u8], ) -> Result<usize, Self::Error>

Write to the buffer with the given address.

This interface must adhere to embedded_io_async::Write::write.

Source

async fn flush(&mut self, address: Self::AddressType) -> Result<(), Self::Error>

Flush this output stream with the given address.

This interface must adhere to embedded_io_async::Write::flush.

Source

async fn read( &mut self, address: Self::AddressType, buf: &mut [u8], ) -> Result<usize, Self::Error>

Read from the buffer with the given address.

This interface must adhere to embedded_io_async::Read::read.

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§