Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Growing Files

An iterator captures the file size when it is created and reads up to that recorded size, even if the file grows while you are reading

Held-Back Items

When a line or segment iterator reaches the recorded file size without finding a terminator and the file has grown beyond that size, it holds the item back instead of yielding it incomplete. If the file has not grown, the final unterminated item is yielded normally

This matters for files being appended to: the last line might not have its \n yet. Yielding it would give you a partial line that changes later. Instead, preader holds the item back and ends iteration

Seeing New Data

To read data that was appended after the iterator was created, resync the state and open a new iterator:

Rust

reader.states().resync("job-1", &file)?;
let lines = reader.lines(&file).state("job-1").build()?;

Python

reader.states.resync("job-1", file)
lines = reader.lines(file, state="job-1")

Data appended after the iterator was created is invisible until you resync and open a new iterator