We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
read_exact
Bytes::next
1 parent 69ad06f commit ed2a587Copy full SHA for ed2a587
library/std/src/io/mod.rs
@@ -2781,13 +2781,10 @@ impl<R: Read> Iterator for Bytes<R> {
2781
2782
#[inline]
2783
fn next(&mut self) -> Option<Result<u8>> {
2784
- loop {
2785
- return match self.inner.read(slice::from_mut(&mut self.byte)) {
2786
- Ok(0) => None,
2787
- Ok(..) => Some(Ok(self.byte)),
2788
- Err(ref e) if e.is_interrupted() => continue,
2789
- Err(e) => Some(Err(e)),
2790
- };
+ match self.inner.read_exact(slice::from_mut(&mut self.byte)) {
+ Ok(()) => Some(Ok(self.byte)),
+ Err(e) if e.kind() == ErrorKind::UnexpectedEof => None,
+ Err(e) => Some(Err(e)),
2791
}
2792
2793
0 commit comments