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

Pagination

The skip and limit options control how many items the iterator yields, independent of byte offsets

skip

The number of items to skip before yielding the first result. Default: 0

How skipping works depends on the iterator type:

  • Bytes and chunks: skip is folded into the start offset as pure arithmetic. No data is read and discarded
  • Lines and segments: skipped items are read and discarded at runtime, because their byte length is not known in advance

limit

The maximum number of items to yield. Default: u64::MAX (no limit). Once the limit is reached, the iterator stops

Examples

Rust

// Skip the first 10 lines, then read the next 5
let lines = reader.lines("data.txt")
    .skip(10)
    .limit(5)
    .build()?;

for line in lines {
    println!("{}", line?);
}

Python

from preader import IteratorOptions

options = IteratorOptions(skip=10, limit=5)

for line in reader.lines("data.txt", options=options):
    print(line)

You can combine skip and limit with start and end. The byte range is applied first, then skip and limit operate within that range

For line iterators, skipped content is not UTF-8 validated. Only yielded items go through validation