MCPcopy Create free account
hub / github.com/bytesize-rs/bytesize / skip_while

Function skip_while

src/parse.rs:49–59  ·  view source on GitHub ↗
(s: &str, mut predicate: P)

Source from the content-addressed store, hash-verified

47}
48
49fn skip_while<P>(s: &str, mut predicate: P) -> &str
50where
51 P: FnMut(char) -> bool,
52{
53 let offset: usize = s
54 .chars()
55 .skip_while(|ch| predicate(*ch))
56 .map(|ch| ch.len_utf8())
57 .sum();
58 &s[(s.len() - offset)..]
59}
60
61/// Scale unit.
62///

Callers 1

from_strMethod · 0.85

Calls 1

sumMethod · 0.80

Tested by

no test coverage detected