Skip to main content

separator_run_len

Function separator_run_len 

Source
pub fn separator_run_len(bytes: &[u8], at: usize) -> usize
Expand description

The length in bytes of the digit-separator run at at, or 0 if there is none.

Total on any input: it checks both sides, so a caller cannot get a nonzero answer for a _ that is not between digits. The lexer’s three digit runs each ask only after consuming at least one digit, so the left-hand check is always satisfied there — it is written out anyway rather than leaving this predicate’s correctness dependent on where the caller stands.