Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
kanarus committed Jul 8, 2024
2 parents a6bd9cf + ef8cd6f commit f3cd86c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "byte_reader"
version = "3.1.0"
version = "3.1.1"
edition = "2021"
authors = ["kanarus <[email protected]>"]
documentation = "https://docs.rs/byte_reader"
Expand Down
4 changes: 3 additions & 1 deletion package/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)`
Expand Down

0 comments on commit f3cd86c

Please sign in to comment.