@@ -2,12 +2,12 @@ use core::{
22 pin:: Pin ,
33 task:: { Context , Poll } ,
44} ;
5- use std:: io:: Result ;
5+ use std:: io:: { IoSlice , Result } ;
66
77use crate :: { codec:: Decode , util:: PartialBuffer } ;
88use futures_core:: ready;
99use pin_project_lite:: pin_project;
10- use tokio:: io:: { AsyncBufRead , AsyncRead , ReadBuf } ;
10+ use tokio:: io:: { AsyncBufRead , AsyncRead , AsyncWrite , ReadBuf } ;
1111
1212#[ derive( Debug ) ]
1313enum State {
@@ -162,3 +162,33 @@ impl<R: AsyncBufRead, D: Decode> AsyncRead for Decoder<R, D> {
162162 }
163163 }
164164}
165+
166+ impl < R : AsyncBufRead + AsyncWrite , D : Decode > AsyncWrite for Decoder < R , D > {
167+ fn poll_write (
168+ mut self : Pin < & mut Self > ,
169+ cx : & mut Context < ' _ > ,
170+ buf : & [ u8 ] ,
171+ ) -> Poll < Result < usize > > {
172+ self . get_pin_mut ( ) . poll_write ( cx, buf)
173+ }
174+
175+ fn poll_write_vectored (
176+ mut self : Pin < & mut Self > ,
177+ cx : & mut Context < ' _ > ,
178+ mut bufs : & [ IoSlice < ' _ > ] ,
179+ ) -> Poll < Result < usize > > {
180+ self . get_pin_mut ( ) . poll_write_vectored ( cx, bufs)
181+ }
182+
183+ fn is_write_vectored ( & self ) -> bool {
184+ self . get_ref ( ) . is_write_vectored ( )
185+ }
186+
187+ fn poll_flush ( mut self : Pin < & mut Self > , cx : & mut Context < ' _ > ) -> Poll < Result < ( ) > > {
188+ self . get_pin_mut ( ) . poll_flush ( cx)
189+ }
190+
191+ fn poll_shutdown ( mut self : Pin < & mut Self > , cx : & mut Context < ' _ > ) -> Poll < Result < ( ) > > {
192+ self . get_pin_mut ( ) . poll_shutdown ( cx)
193+ }
194+ }
0 commit comments