Skip to main content

page_lines

Function page_lines 

pub fn page_lines(
    reader: impl BufRead,
    offset: i64,
    limit: u32,
    numbered: bool,
) -> Result<Page, PageError>
Expand description

Page the lines of reader: from line offset (negative: from the end), at most limit lines and PAGE_BYTES of rendered text (numbered: with the number of each line in front), and at least one line. A line over MAX_LINE_CHARS is cut.

The whole stream is read, to count its lines. A NUL in the first 8 KiB, or in a line of the page, is PageError::Binary.

ยงErrors

See PageError. An empty stream is a page with no lines (total 0), not an error.