Skip to main content

read_log_line_capped

Function read_log_line_capped 

Source
pub fn read_log_line_capped<R: BufRead>(
    r: &mut R,
    max_bytes: usize,
    buf: &mut Vec<u8>,
) -> Result<Option<LineRead>>
Expand description

Append up to max_bytes of the next line to buf, consuming the rest of the line from r regardless. None when the reader was already at EOF.

For readers that own their read loop: a tail -f follower resumes an unterminated line by calling again with the same buf, so max_bytes is measured against what buf already holds. Everything else wants read_log_lines_capped, which owns the loop.