@@ -186,7 +186,7 @@ where
186186 self . read_buf . reserve ( next) ;
187187 }
188188
189- let dst = self . read_buf . bytes_mut ( ) ;
189+ let dst = self . read_buf . chunk_mut ( ) ;
190190 let dst = unsafe { & mut * ( dst as * mut _ as * mut [ MaybeUninit < u8 > ] ) } ;
191191 let mut buf = ReadBuf :: uninit ( dst) ;
192192 match Pin :: new ( & mut self . io ) . poll_read ( cx, & mut buf) {
@@ -231,10 +231,11 @@ where
231231 return self . poll_flush_flattened ( cx) ;
232232 }
233233
234+ const MAX_WRITEV_BUFS : usize = 64 ;
234235 loop {
235236 let n = {
236- let mut iovs = [ IoSlice :: new ( & [ ] ) ; crate :: common :: io :: MAX_WRITEV_BUFS ] ;
237- let len = self . write_buf . bytes_vectored ( & mut iovs) ;
237+ let mut iovs = [ IoSlice :: new ( & [ ] ) ; MAX_WRITEV_BUFS ] ;
238+ let len = self . write_buf . chunks_vectored ( & mut iovs) ;
238239 ready ! ( Pin :: new( & mut self . io) . poll_write_vectored( cx, & iovs[ ..len] ) ) ?
239240 } ;
240241 // TODO(eliza): we have to do this manually because
@@ -262,7 +263,7 @@ where
262263 /// that skips some bookkeeping around using multiple buffers.
263264 fn poll_flush_flattened ( & mut self , cx : & mut task:: Context < ' _ > ) -> Poll < io:: Result < ( ) > > {
264265 loop {
265- let n = ready ! ( Pin :: new( & mut self . io) . poll_write( cx, self . write_buf. headers. bytes ( ) ) ) ?;
266+ let n = ready ! ( Pin :: new( & mut self . io) . poll_write( cx, self . write_buf. headers. chunk ( ) ) ) ?;
266267 debug ! ( "flushed {} bytes" , n) ;
267268 self . write_buf . headers . advance ( n) ;
268269 if self . write_buf . headers . remaining ( ) == 0 {
@@ -433,7 +434,7 @@ impl<T: AsRef<[u8]>> Buf for Cursor<T> {
433434 }
434435
435436 #[ inline]
436- fn bytes ( & self ) -> & [ u8 ] {
437+ fn chunk ( & self ) -> & [ u8 ] {
437438 & self . bytes . as_ref ( ) [ self . pos ..]
438439 }
439440
@@ -487,7 +488,7 @@ where
487488 //but accomplishes the same result.
488489 loop {
489490 let adv = {
490- let slice = buf. bytes ( ) ;
491+ let slice = buf. chunk ( ) ;
491492 if slice. is_empty ( ) {
492493 return ;
493494 }
@@ -534,12 +535,12 @@ impl<B: Buf> Buf for WriteBuf<B> {
534535 }
535536
536537 #[ inline]
537- fn bytes ( & self ) -> & [ u8 ] {
538- let headers = self . headers . bytes ( ) ;
538+ fn chunk ( & self ) -> & [ u8 ] {
539+ let headers = self . headers . chunk ( ) ;
539540 if !headers. is_empty ( ) {
540541 headers
541542 } else {
542- self . queue . bytes ( )
543+ self . queue . chunk ( )
543544 }
544545 }
545546
@@ -559,9 +560,9 @@ impl<B: Buf> Buf for WriteBuf<B> {
559560 }
560561
561562 #[ inline]
562- fn bytes_vectored < ' t > ( & ' t self , dst : & mut [ IoSlice < ' t > ] ) -> usize {
563- let n = self . headers . bytes_vectored ( dst) ;
564- self . queue . bytes_vectored ( & mut dst[ n..] ) + n
563+ fn chunks_vectored < ' t > ( & ' t self , dst : & mut [ IoSlice < ' t > ] ) -> usize {
564+ let n = self . headers . chunks_vectored ( dst) ;
565+ self . queue . chunks_vectored ( & mut dst[ n..] ) + n
565566 }
566567}
567568
0 commit comments