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

Iterators

preader has several iterator types, each for a different kind of file content:

IteratorYieldsUse When
LinesUTF-8 stringsThe file is text with newline-separated records
BytesSingle bytesYou need byte-level control
ChunksByte slicesYou want to process raw data in even blocks
SegmentsDelimiter separated byte slicesThe file uses a custom delimiter (e.g. CSV fields)

All iterators share a common interface:

  • state / state() returns a snapshot of the current read position and file metadata
  • percent() returns progress through the file as a floating-point percentage
  • save() persists the current position to disk and returns the saved state

They differ in what they yield and which options they accept. Each page below covers one type with its options and examples in both Rust and Python