for_each_line
Mojo function 🡭
for_each_line
➕
➖def for_each_line[func: def(Span[UInt8, origin_of(origin)], Int, Int) capturing thin -> None](path: String, buf_size: Int = 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 (
def(Span[UInt8, origin_of(origin)], Int, Int) capturing thin -> 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: