Skip to main content

read

Function read 

Source
pub fn read<T: EventListener>(
    term: &Term<T>,
    appended: u64,
    since: Option<u64>,
    max_lines: usize,
    max_bytes: usize,
) -> ReadResult
Expand description

A bounded read of the buffer from since, or the tail when since is absent or older than the buffer.

The cursor is a lifetime line number, not a buffer position. The scrollback is bounded, so the buffer’s own count stops advancing once it fills; appended is how many lines have ever entered it, and the buffer’s first line is appended - total. A caller that falls further behind than the buffer gets the tail and truncated says so.

A read that reaches the buffer’s last line hands back that line’s index, so the next read repeats it: the last line can still change while a program is writing.