Skip to main content

stream_lines

Function stream_lines 

Source
pub fn stream_lines<F>(path: &Path, line_fn: F) -> Result<usize>
where F: FnMut(usize, &str) -> Result<()>,
Expand description

Processes a file by reading line-by-line with constant memory.

Calls line_fn for each line. The line buffer is reused across iterations — memory does not grow with file length.

§Errors

Returns an error if the file cannot be read.