@@ -278,7 +278,7 @@ pub use self::{
278278} ;
279279
280280#[ unstable( feature = "read_buf" , issue = "78485" ) ]
281- pub use self :: readbuf:: { BorrowBuf , BorrowCursor } ;
281+ pub use self :: readbuf:: { BorrowedBuf , BorrowedCursor } ;
282282pub ( crate ) use error:: const_io_error;
283283
284284mod buffered;
@@ -362,7 +362,7 @@ pub(crate) fn default_read_to_end<R: Read + ?Sized>(r: &mut R, buf: &mut Vec<u8>
362362 buf. reserve ( 32 ) ; // buf is full, need more space
363363 }
364364
365- let mut read_buf: BorrowBuf < ' _ > = buf. spare_capacity_mut ( ) . into ( ) ;
365+ let mut read_buf: BorrowedBuf < ' _ > = buf. spare_capacity_mut ( ) . into ( ) ;
366366
367367 // SAFETY: These bytes were initialized but not filled in the previous loop
368368 unsafe {
@@ -383,7 +383,7 @@ pub(crate) fn default_read_to_end<R: Read + ?Sized>(r: &mut R, buf: &mut Vec<u8>
383383 // store how much was initialized but not filled
384384 initialized = cursor. init_ref ( ) . len ( ) ;
385385
386- // SAFETY: BorrowBuf 's invariants mean this much memory is initialized.
386+ // SAFETY: BorrowedBuf 's invariants mean this much memory is initialized.
387387 unsafe {
388388 let new_len = read_buf. filled ( ) . len ( ) + buf. len ( ) ;
389389 buf. set_len ( new_len) ;
@@ -462,7 +462,7 @@ pub(crate) fn default_read_exact<R: Read + ?Sized>(this: &mut R, mut buf: &mut [
462462 }
463463}
464464
465- pub ( crate ) fn default_read_buf < F > ( read : F , mut cursor : BorrowCursor < ' _ , ' _ > ) -> Result < ( ) >
465+ pub ( crate ) fn default_read_buf < F > ( read : F , mut cursor : BorrowedCursor < ' _ , ' _ > ) -> Result < ( ) >
466466where
467467 F : FnOnce ( & mut [ u8 ] ) -> Result < usize > ,
468468{
@@ -805,24 +805,23 @@ pub trait Read {
805805 default_read_exact ( self , buf)
806806 }
807807
808- // TODO naming, if should the method be read_cursor? Or should we change the names of the data structures?
809808 /// Pull some bytes from this source into the specified buffer.
810809 ///
811- /// This is equivalent to the [`read`](Read::read) method, except that it is passed a [`BorrowCursor `] rather than `[u8]` to allow use
810+ /// This is equivalent to the [`read`](Read::read) method, except that it is passed a [`BorrowedCursor `] rather than `[u8]` to allow use
812811 /// with uninitialized buffers. The new data will be appended to any existing contents of `buf`.
813812 ///
814813 /// The default implementation delegates to `read`.
815814 #[ unstable( feature = "read_buf" , issue = "78485" ) ]
816- fn read_buf ( & mut self , buf : BorrowCursor < ' _ , ' _ > ) -> Result < ( ) > {
815+ fn read_buf ( & mut self , buf : BorrowedCursor < ' _ , ' _ > ) -> Result < ( ) > {
817816 default_read_buf ( |b| self . read ( b) , buf)
818817 }
819818
820819 /// Read the exact number of bytes required to fill `cursor`.
821820 ///
822- /// This is equivalent to the [`read_exact`](Read::read_exact) method, except that it is passed a [`BorrowCursor `] rather than `[u8]` to
821+ /// This is equivalent to the [`read_exact`](Read::read_exact) method, except that it is passed a [`BorrowedCursor `] rather than `[u8]` to
823822 /// allow use with uninitialized buffers.
824823 #[ unstable( feature = "read_buf" , issue = "78485" ) ]
825- fn read_buf_exact ( & mut self , mut cursor : BorrowCursor < ' _ , ' _ > ) -> Result < ( ) > {
824+ fn read_buf_exact ( & mut self , mut cursor : BorrowedCursor < ' _ , ' _ > ) -> Result < ( ) > {
826825 while cursor. capacity ( ) > 0 {
827826 let prev_written = cursor. written ( ) ;
828827 match self . read_buf ( cursor. clone ( ) ) {
@@ -2587,7 +2586,7 @@ impl<T: Read> Read for Take<T> {
25872586 Ok ( n)
25882587 }
25892588
2590- fn read_buf ( & mut self , mut buf : BorrowCursor < ' _ , ' _ > ) -> Result < ( ) > {
2589+ fn read_buf ( & mut self , mut buf : BorrowedCursor < ' _ , ' _ > ) -> Result < ( ) > {
25912590 // Don't call into inner reader at all at EOF because it may still block
25922591 if self . limit == 0 {
25932592 return Ok ( ( ) ) ;
@@ -2602,7 +2601,7 @@ impl<T: Read> Read for Take<T> {
26022601 // SAFETY: no uninit data is written to ibuf
26032602 let ibuf = unsafe { & mut buf. as_mut ( ) [ ..limit] } ;
26042603
2605- let mut sliced_buf: BorrowBuf < ' _ > = ibuf. into ( ) ;
2604+ let mut sliced_buf: BorrowedBuf < ' _ > = ibuf. into ( ) ;
26062605
26072606 // SAFETY: extra_init bytes of ibuf are known to be initialized
26082607 unsafe {
0 commit comments