pub fn read_log_lines_capped<R: BufRead>(
r: R,
max_bytes: usize,
) -> impl Iterator<Item = Result<CappedLine>>Expand description
Read newline-delimited log lines, never materializing more than max_bytes
of any one of them.
A line past the bound is decoded up to it and the rest discarded while the
reader scans on to the newline, so a consumer’s peak memory is its own choice
rather than the longest line the file happens to hold. Every discard is
reported in CappedLine::over_cap with the physical line’s full length.