From 4d6810844e1b7a10af1da44d3217a66005866234 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Thu, 12 Oct 2023 10:49:32 +1100 Subject: [PATCH] Inline `Bytes::next` and `Bytes::size_hint`. This greatly increases its speed. --- library/std/src/io/mod.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/library/std/src/io/mod.rs b/library/std/src/io/mod.rs index e6431abcf82..c0a72948112 100644 --- a/library/std/src/io/mod.rs +++ b/library/std/src/io/mod.rs @@ -2777,6 +2777,7 @@ pub struct Bytes { impl Iterator for Bytes { type Item = Result; + #[inline] fn next(&mut self) -> Option> { let mut byte = 0; loop { @@ -2789,6 +2790,7 @@ fn next(&mut self) -> Option> { } } + #[inline] fn size_hint(&self) -> (usize, Option) { SizeHint::size_hint(&self.inner) }