Skip to main content

Module lines

Module lines 

Source
Expand description

Text read as it stands: a row per line, in a line column.

One pass records line starts (LineIndex); lines are read from a map where shown, so only rows a view reaches are decoded. Every line is a row, blank ones included, carrying its file position (crate::formats::row_index::INDEX) so # numbers it like less -N through sorts and filters. \r\n ends a line; invalid UTF-8 shows as � and is noted; control characters stay and are escaped at draw (crate::sanitize).

A large file shows rows once its first FIRST_BYTES are indexed, the rest indexed behind (Lines::index_more) as the frame’s height (bound) grows. A followed file’s lines are counted by the watcher (crate::loading::follow).

guess says what unclaimed text is: JSON, CSV or TSV only on evidence, else lines.

Structs§

LineIndex
Where each line of some bytes starts, from one pass. Read on from where it left off as the bytes grow: a last line with no newline yet is read again.
Lines
The lines of one file or several, read where they are shown.

Constants§

FILE
The columns: the file a line is from (several files only), and the line.
FIRST_BYTES
Bytes an open indexes before it shows the first rows. Past this the rest of a file is indexed in the background.
LINE
SHRANK
What a read of every line says when the file shrank as it was indexed.

Functions§

as_asked
A guess of lines turned to CSV when the user gave a delimited dialect (--delimiter, --comment, --header-rows, --skip-initial-space): they said the text is delimited, in a shape the guess does not try.
guess
What unclaimed text is, from its first bytes head (whole when that is everything, so an unterminated last line is complete); None for non-text (hex view locally). JSON only if it parses so far; NDJSON if the first line is an object; CSV or TSV only if several complete records share a field count of two or more (CSV quoting allowed); otherwise lines.
guess_file
guess for the local file at path, through its compression. What is inside a compressed file is read through it only as delimited text or lines.
schema
The columns of one file’s lines, or several files’ with the file named.