Skip to content

Commit 4d68108

Browse files
committed
Inline Bytes::next and Bytes::size_hint.
This greatly increases its speed.
1 parent 64368d0 commit 4d68108

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Diff for: library/std/src/io/mod.rs

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

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

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

0 commit comments

Comments
 (0)