diff --git a/package/Cargo.toml b/package/Cargo.toml index b9aaa05..ada1756 100644 --- a/package/Cargo.toml +++ b/package/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "byte_reader" -version = "3.1.0" +version = "3.1.1" edition = "2021" authors = ["kanarus "] documentation = "https://docs.rs/byte_reader" diff --git a/package/src/lib.rs b/package/src/lib.rs index edd834e..ccaee83 100644 --- a/package/src/lib.rs +++ b/package/src/lib.rs @@ -80,7 +80,9 @@ impl<'r> Reader<'r> { /// Skip next byte while `condition` holds on it #[inline] pub fn skip_while(&mut self, condition: impl Fn(&u8)->bool) { - let by = self.remaining().iter().take_while(|b| condition(b)).count(); + let mut by = 0; for b in self.remaining() { + if condition(b) {by += 1} else {break} + } self.advance_unchecked_by(by) } /// `skip_while(u8::is_ascii_whitespace)`