File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -25,3 +25,15 @@ pub trait AsyncRead {
2525 }
2626 }
2727}
28+
29+ impl < R : AsyncRead + ?Sized > AsyncRead for & mut R {
30+ #[ inline]
31+ async fn read ( & mut self , buf : & mut [ u8 ] ) -> io:: Result < usize > {
32+ ( * self ) . read ( buf) . await
33+ }
34+
35+ #[ inline]
36+ async fn read_to_end ( & mut self , buf : & mut Vec < u8 > ) -> io:: Result < usize > {
37+ ( * self ) . read_to_end ( buf) . await
38+ }
39+ }
Original file line number Diff line number Diff line change @@ -17,3 +17,20 @@ pub trait AsyncWrite {
1717 }
1818 }
1919}
20+
21+ impl < W : AsyncWrite + ?Sized > AsyncWrite for & mut W {
22+ #[ inline]
23+ async fn write ( & mut self , buf : & [ u8 ] ) -> io:: Result < usize > {
24+ ( * self ) . write ( buf) . await
25+ }
26+
27+ #[ inline]
28+ async fn flush ( & mut self ) -> io:: Result < ( ) > {
29+ ( * self ) . flush ( ) . await
30+ }
31+
32+ #[ inline]
33+ async fn write_all ( & mut self , buf : & [ u8 ] ) -> io:: Result < ( ) > {
34+ ( * self ) . write_all ( buf) . await
35+ }
36+ }
You can’t perform that action at this time.
0 commit comments