Skip to main content

BufferInterface

Trait BufferInterface 

Source
pub trait BufferInterface: BufferInterfaceBase {
    // Required methods
    fn write(
        &mut self,
        address: Self::AddressType,
        buf: &[u8],
    ) -> Result<usize, Self::Error>;
    fn flush(&mut self, address: Self::AddressType) -> Result<(), Self::Error>;
    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 Methods§

Source

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::Write::write].

Source

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::Write::flush].

Source

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::Read::read].

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T: BufferInterface> BufferInterface for &mut T

Source§

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

Source§

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

Source§

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

Implementors§