pub trait BufferInterface: BufferInterfaceError {
type AddressType: Copy;
// 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 Associated Types§
Sourcetype AddressType: Copy
type AddressType: Copy
The address type used by this interface. Should likely be an integer.
Required Methods§
Sourcefn write(
&mut self,
address: Self::AddressType,
buf: &[u8],
) -> Result<usize, Self::Error>
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.
Sourcefn flush(&mut self, address: Self::AddressType) -> Result<(), Self::Error>
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.
Sourcefn read(
&mut self,
address: Self::AddressType,
buf: &mut [u8],
) -> Result<usize, Self::Error>
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.