Skip to content

Commit ca7eef7

Browse files
committed
Inline Bytes::next and Bytes::size_hint.
This greatly increases its speed.
1 parent 475c71d commit ca7eef7

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

library/std/src/io/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -2778,6 +2778,7 @@ pub struct Bytes<R> {
27782778
impl<R: Read> Iterator for Bytes<R> {
27792779
type Item = Result<u8>;
27802780

2781+
#[inline]
27812782
fn next(&mut self) -> Option<Result<u8>> {
27822783
let mut byte = 0;
27832784
loop {
@@ -2790,6 +2791,7 @@ impl<R: Read> Iterator for Bytes<R> {
27902791
}
27912792
}
27922793

2794+
#[inline]
27932795
fn size_hint(&self) -> (usize, Option<usize>) {
27942796
SizeHint::size_hint(&self.inner)
27952797
}

0 commit comments

Comments
 (0)