Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions embedded-io-async/src/impls/boxx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ impl<T: ?Sized + Read> Read for Box<T> {
async fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error> {
T::read(self, buf).await
}

#[inline]
async fn read_exact(
&mut self,
buf: &mut [u8],
) -> Result<(), crate::ReadExactError<Self::Error>> {
T::read_exact(self, buf).await
}
}

#[cfg_attr(docsrs, doc(cfg(any(feature = "std", feature = "alloc"))))]
Expand All @@ -29,6 +37,11 @@ impl<T: ?Sized + Write> Write for Box<T> {
T::write(self, buf).await
}

#[inline]
async fn write_all(&mut self, buf: &[u8]) -> Result<(), Self::Error> {
T::write_all(self, buf).await
}

#[inline]
async fn flush(&mut self) -> Result<(), Self::Error> {
T::flush(self).await
Expand All @@ -41,4 +54,14 @@ impl<T: ?Sized + Seek> Seek for Box<T> {
async fn seek(&mut self, pos: SeekFrom) -> Result<u64, Self::Error> {
T::seek(self, pos).await
}

#[inline]
async fn rewind(&mut self) -> Result<(), Self::Error> {
T::rewind(self).await
}

#[inline]
async fn stream_position(&mut self) -> Result<u64, Self::Error> {
T::stream_position(self).await
}
}
34 changes: 34 additions & 0 deletions embedded-io/src/impls/boxx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ impl<T: ?Sized + Read> Read for Box<T> {
fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error> {
T::read(self, buf)
}

#[inline]
fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), crate::ReadExactError<Self::Error>> {
T::read_exact(self, buf)
}
}

#[cfg_attr(docsrs, doc(cfg(any(feature = "std", feature = "alloc"))))]
Expand All @@ -20,6 +25,7 @@ impl<T: ?Sized + BufRead> BufRead for Box<T> {
T::fill_buf(self)
}

#[inline]
fn consume(&mut self, amt: usize) {
T::consume(self, amt);
}
Expand All @@ -32,6 +38,19 @@ impl<T: ?Sized + Write> Write for Box<T> {
T::write(self, buf)
}

#[inline]
fn write_all(&mut self, buf: &[u8]) -> Result<(), Self::Error> {
T::write_all(self, buf)
}

#[inline]
fn write_fmt(
&mut self,
fmt: core::fmt::Arguments<'_>,
) -> Result<(), crate::WriteFmtError<Self::Error>> {
T::write_fmt(self, fmt)
}

#[inline]
fn flush(&mut self) -> Result<(), Self::Error> {
T::flush(self)
Expand All @@ -44,6 +63,21 @@ impl<T: ?Sized + Seek> Seek for Box<T> {
fn seek(&mut self, pos: crate::SeekFrom) -> Result<u64, Self::Error> {
T::seek(self, pos)
}

#[inline]
fn rewind(&mut self) -> Result<(), Self::Error> {
T::rewind(self)
}

#[inline]
fn stream_position(&mut self) -> Result<u64, Self::Error> {
T::stream_position(self)
}

#[inline]
fn seek_relative(&mut self, offset: i64) -> Result<(), Self::Error> {
T::seek_relative(self, offset)
}
}

#[cfg_attr(docsrs, doc(cfg(any(feature = "std", feature = "alloc"))))]
Expand Down