Skip to content

Commit 83f17d4

Browse files
committed
io: forward calls in blanket impls
1 parent e9a29dd commit 83f17d4

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed

embedded-io-async/src/lib.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,13 +175,20 @@ impl<T: ?Sized + Read> Read for &mut T {
175175
async fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error> {
176176
T::read(self, buf).await
177177
}
178+
179+
#[inline]
180+
async fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), ReadExactError<Self::Error>> {
181+
T::read_exact(self, buf).await
182+
}
178183
}
179184

180185
impl<T: ?Sized + BufRead> BufRead for &mut T {
186+
#[inline]
181187
async fn fill_buf(&mut self) -> Result<&[u8], Self::Error> {
182188
T::fill_buf(self).await
183189
}
184190

191+
#[inline]
185192
fn consume(&mut self, amt: usize) {
186193
T::consume(self, amt);
187194
}
@@ -197,11 +204,26 @@ impl<T: ?Sized + Write> Write for &mut T {
197204
async fn flush(&mut self) -> Result<(), Self::Error> {
198205
T::flush(self).await
199206
}
207+
208+
#[inline]
209+
async fn write_all(&mut self, buf: &[u8]) -> Result<(), Self::Error> {
210+
T::write_all(self, buf).await
211+
}
200212
}
201213

202214
impl<T: ?Sized + Seek> Seek for &mut T {
203215
#[inline]
204216
async fn seek(&mut self, pos: SeekFrom) -> Result<u64, Self::Error> {
205217
T::seek(self, pos).await
206218
}
219+
220+
#[inline]
221+
async fn rewind(&mut self) -> Result<(), Self::Error> {
222+
T::rewind(self).await
223+
}
224+
225+
#[inline]
226+
async fn stream_position(&mut self) -> Result<u64, Self::Error> {
227+
T::stream_position(self).await
228+
}
207229
}

embedded-io/src/lib.rs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -558,13 +558,20 @@ impl<T: ?Sized + Read> Read for &mut T {
558558
fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error> {
559559
T::read(self, buf)
560560
}
561+
562+
#[inline]
563+
fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), ReadExactError<Self::Error>> {
564+
T::read_exact(self, buf)
565+
}
561566
}
562567

563568
impl<T: ?Sized + BufRead> BufRead for &mut T {
569+
#[inline]
564570
fn fill_buf(&mut self) -> Result<&[u8], Self::Error> {
565571
T::fill_buf(self)
566572
}
567573

574+
#[inline]
568575
fn consume(&mut self, amt: usize) {
569576
T::consume(self, amt);
570577
}
@@ -580,13 +587,33 @@ impl<T: ?Sized + Write> Write for &mut T {
580587
fn flush(&mut self) -> Result<(), Self::Error> {
581588
T::flush(self)
582589
}
590+
591+
#[inline]
592+
fn write_all(&mut self, buf: &[u8]) -> Result<(), Self::Error> {
593+
T::write_all(self, buf)
594+
}
583595
}
584596

585597
impl<T: ?Sized + Seek> Seek for &mut T {
586598
#[inline]
587599
fn seek(&mut self, pos: SeekFrom) -> Result<u64, Self::Error> {
588600
T::seek(self, pos)
589601
}
602+
603+
#[inline]
604+
fn rewind(&mut self) -> Result<(), Self::Error> {
605+
T::rewind(self)
606+
}
607+
608+
#[inline]
609+
fn stream_position(&mut self) -> Result<u64, Self::Error> {
610+
T::stream_position(self)
611+
}
612+
613+
#[inline]
614+
fn seek_relative(&mut self, offset: i64) -> Result<(), Self::Error> {
615+
T::seek_relative(self, offset)
616+
}
590617
}
591618

592619
impl<T: ?Sized + ReadReady> ReadReady for &mut T {

0 commit comments

Comments
 (0)