Struct BufferOperation

Source
pub struct BufferOperation<'i, Interface, AddressType: Copy, Access> { /* private fields */ }
Expand description

Intermediate type for doing buffer operations

If the interface error implements embedded_io::Error, then this operation type also implements the embedded_io traits

Implementations§

Source§

impl<Interface, AddressType: Copy, Access> BufferOperation<'_, Interface, AddressType, Access>
where Interface: BufferInterface<AddressType = AddressType>, Access: WriteCapability,

Source

pub fn write(&mut self, buf: &[u8]) -> Result<usize, Interface::Error>

Write a buffer into this writer, returning how many bytes were written.

Mirror function of embedded_io::Write::write.

Source

pub fn write_all(&mut self, buf: &[u8]) -> Result<(), Interface::Error>

Write an entire buffer into this writer.

This function calls write() in a loop until exactly buf.len() bytes have been written, blocking if needed.

Mirror function of embedded_io::Write::write_all.

Source

pub fn flush(&mut self) -> Result<(), Interface::Error>

Flush this output stream, blocking until all intermediately buffered contents reach their destination.

Mirror function of embedded_io::Write::flush.

Source§

impl<Interface, AddressType: Copy, Access> BufferOperation<'_, Interface, AddressType, Access>
where Interface: BufferInterface<AddressType = AddressType>, Access: ReadCapability,

Source

pub fn read(&mut self, buf: &mut [u8]) -> Result<usize, Interface::Error>

Read some bytes from this source into the specified buffer, returning how many bytes were read.

Mirror function of embedded_io::Read::read.

Source

pub fn read_exact( &mut self, buf: &mut [u8], ) -> Result<(), ReadExactError<Interface::Error>>

Read the exact number of bytes required to fill buf. This function calls read() in a loop until exactly buf.len() bytes have been read, blocking if needed.

Mirror function of embedded_io::Read::read_exact.

Source§

impl<Interface, AddressType: Copy, Access> BufferOperation<'_, Interface, AddressType, Access>
where Interface: AsyncBufferInterface<AddressType = AddressType>, Access: WriteCapability,

Source

pub async fn write_async( &mut self, buf: &[u8], ) -> Result<usize, Interface::Error>

Write a buffer into this writer, returning how many bytes were written.

Mirror function of embedded_io_async::Write::write.

Source

pub async fn write_all_async( &mut self, buf: &[u8], ) -> Result<(), Interface::Error>

Write an entire buffer into this writer.

This function calls write() in a loop until exactly buf.len() bytes have been written, blocking if needed.

Mirror function of embedded_io_async::Write::write_all.

Source

pub async fn flush_async(&mut self) -> Result<(), Interface::Error>

Flush this output stream, blocking until all intermediately buffered contents reach their destination.

Mirror function of embedded_io_async::Write::flush.

Source§

impl<Interface, AddressType: Copy, Access> BufferOperation<'_, Interface, AddressType, Access>
where Interface: AsyncBufferInterface<AddressType = AddressType>, Access: ReadCapability,

Source

pub async fn read_async( &mut self, buf: &mut [u8], ) -> Result<usize, Interface::Error>

Read some bytes from this source into the specified buffer, returning how many bytes were read.

Mirror function of embedded_io_async::Read::read.

Source

pub async fn read_exact_async( &mut self, buf: &mut [u8], ) -> Result<(), ReadExactError<Interface::Error>>

Read the exact number of bytes required to fill buf.

This function calls read() in a loop until exactly buf.len() bytes have been read, waiting if needed.

Mirror function of embedded_io_async::Read::read_exact.

Trait Implementations§

Source§

impl<Interface, AddressType: Copy, Access> ErrorType for BufferOperation<'_, Interface, AddressType, Access>
where Interface: BufferInterfaceError, Interface::Error: Error,

Source§

type Error = <Interface as BufferInterfaceError>::Error

Error type of all the IO operations on this type.
Source§

impl<Interface, AddressType: Copy, Access> Read for BufferOperation<'_, Interface, AddressType, Access>
where Interface: BufferInterface<AddressType = AddressType>, Interface::Error: Error, Access: ReadCapability,

Source§

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

Read some bytes from this source into the specified buffer, returning how many bytes were read. Read more
Source§

fn read_exact( &mut self, buf: &mut [u8], ) -> Result<(), ReadExactError<Self::Error>>

Read the exact number of bytes required to fill buf. Read more
Source§

impl<Interface, AddressType: Copy, Access> Read for BufferOperation<'_, Interface, AddressType, Access>
where Interface: AsyncBufferInterface<AddressType = AddressType>, Interface::Error: Error, Access: ReadCapability,

Source§

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

Read some bytes from this source into the specified buffer, returning how many bytes were read. Read more
Source§

async fn read_exact( &mut self, buf: &mut [u8], ) -> Result<(), ReadExactError<Self::Error>>

Read the exact number of bytes required to fill buf. Read more
Source§

impl<Interface, AddressType: Copy, Access> Write for BufferOperation<'_, Interface, AddressType, Access>
where Interface: BufferInterface<AddressType = AddressType>, Interface::Error: Error, Access: WriteCapability,

Source§

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

Write a buffer into this writer, returning how many bytes were written. Read more
Source§

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

Flush this output stream, blocking until all intermediately buffered contents reach their destination.
Source§

fn write_all(&mut self, buf: &[u8]) -> Result<(), Self::Error>

Write an entire buffer into this writer. Read more
Source§

fn write_fmt( &mut self, fmt: Arguments<'_>, ) -> Result<(), WriteFmtError<Self::Error>>

Write a formatted string into this writer, returning any error encountered. Read more
Source§

impl<Interface, AddressType: Copy, Access> Write for BufferOperation<'_, Interface, AddressType, Access>
where Interface: AsyncBufferInterface<AddressType = AddressType>, Interface::Error: Error, Access: WriteCapability,

Source§

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

Write a buffer into this writer, returning how many bytes were written. Read more
Source§

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

Flush this output stream, ensuring that all intermediately buffered contents reach their destination.
Source§

async fn write_all(&mut self, buf: &[u8]) -> Result<(), Self::Error>

Write an entire buffer into this writer. Read more

Auto Trait Implementations§

§

impl<'i, Interface, AddressType, Access> Freeze for BufferOperation<'i, Interface, AddressType, Access>
where AddressType: Freeze,

§

impl<'i, Interface, AddressType, Access> RefUnwindSafe for BufferOperation<'i, Interface, AddressType, Access>
where AddressType: RefUnwindSafe, Interface: RefUnwindSafe, Access: RefUnwindSafe,

§

impl<'i, Interface, AddressType, Access> Send for BufferOperation<'i, Interface, AddressType, Access>
where AddressType: Send, Interface: Send, Access: Send,

§

impl<'i, Interface, AddressType, Access> Sync for BufferOperation<'i, Interface, AddressType, Access>
where AddressType: Sync, Interface: Sync, Access: Sync,

§

impl<'i, Interface, AddressType, Access> Unpin for BufferOperation<'i, Interface, AddressType, Access>
where AddressType: Unpin, Access: Unpin,

§

impl<'i, Interface, AddressType, Access> !UnwindSafe for BufferOperation<'i, Interface, AddressType, Access>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.