for_each_line
Mojo function 🡭
for_each_line
➕
➖
fn for_each_line[func: fn[?, mut`: Bool, origin`1: Origin[mut]](Span[UInt8, origin], Int, Int) capturing -> None](path: String, buf_size: Int = 131072)
Call the provided callback on each line.
The callback will be given a buffer, and the [start, end) of where the line is in that buffer.
Parameters:
- func (
fn[?, mut: Bool, origin1: Origin[mut]](Span[UInt8, origin], Int, Int) capturing -> None): The callback to run for each line.
Args:
- path (
String): The file path to open and read. - buf_size (
Int): The size of the buffer to use.
Raises: