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
549549#[ stable( feature = "rust1" , since = "1.0.0" ) ]
550550#[ doc( notable_trait) ]
551551#[ cfg_attr( not( test) , rustc_diagnostic_item = "IoRead" ) ]
552+ #[ rustc_must_implement_one_of( read, read_buf) ]
552553pub trait Read {
553554 /// Pull some bytes from this source into the specified buffer, returning
554555 /// how many bytes were read.
@@ -630,7 +631,10 @@ pub trait Read {
630631 /// }
631632 /// ```
632633 #[ 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+ }
634638
635639 /// Like `read`, except that it reads into a slice of buffers.
636640 ///
You can’t perform that action at this time.
0 commit comments