File tree 1 file changed +4
-4
lines changed
1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -1000,7 +1000,7 @@ pub trait Read {
1000
1000
where
1001
1001
Self : Sized ,
1002
1002
{
1003
- Bytes { inner : self }
1003
+ Bytes { inner : self , byte : 0 }
1004
1004
}
1005
1005
1006
1006
/// Creates an adapter which will chain this stream with another.
@@ -2772,6 +2772,7 @@ impl<T> SizeHint for Take<T> {
2772
2772
#[ derive( Debug ) ]
2773
2773
pub struct Bytes < R > {
2774
2774
inner : R ,
2775
+ byte : u8 ,
2775
2776
}
2776
2777
2777
2778
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
@@ -2780,11 +2781,10 @@ impl<R: Read> Iterator for Bytes<R> {
2780
2781
2781
2782
#[ inline]
2782
2783
fn next ( & mut self ) -> Option < Result < u8 > > {
2783
- let mut byte = 0 ;
2784
2784
loop {
2785
- return match self . inner . read ( slice:: from_mut ( & mut byte) ) {
2785
+ return match self . inner . read ( slice:: from_mut ( & mut self . byte ) ) {
2786
2786
Ok ( 0 ) => None ,
2787
- Ok ( ..) => Some ( Ok ( byte) ) ,
2787
+ Ok ( ..) => Some ( Ok ( self . byte ) ) ,
2788
2788
Err ( ref e) if e. is_interrupted ( ) => continue ,
2789
2789
Err ( e) => Some ( Err ( e) ) ,
2790
2790
} ;
You can’t perform that action at this time.
0 commit comments