File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -549,6 +549,7 @@ where
549
549
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
550
550
#[ doc( notable_trait) ]
551
551
#[ cfg_attr( not( test) , rustc_diagnostic_item = "IoRead" ) ]
552
+ #[ rustc_must_implement_one_of( read, read_buf) ]
552
553
pub trait Read {
553
554
/// Pull some bytes from this source into the specified buffer, returning
554
555
/// how many bytes were read.
@@ -630,7 +631,10 @@ pub trait Read {
630
631
/// }
631
632
/// ```
632
633
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
633
- fn read ( & mut self , buf : & mut [ u8 ] ) -> Result < usize > ;
634
+ fn read ( & mut self , buf : & mut [ u8 ] ) -> Result < usize > {
635
+ let mut buf = BorrowedBuf :: from ( buf) ;
636
+ self . read_buf ( buf. unfilled ( ) ) . map ( |( ) | buf. len ( ) )
637
+ }
634
638
635
639
/// Like `read`, except that it reads into a slice of buffers.
636
640
///
You can’t perform that action at this time.
0 commit comments