Skip to main content

Module custom

Module custom 

Source
Expand description

A flyer’s own logger, read by a column mapping or a record layout stated in a JSON file: what hpr analyze and the Python package take (ADR-276; M7.1d2, your own logger from the command line and Python).

generic::read_with, records::read and capture::read read a log by a mapping or a layout a program builds. This module reads the mapping or layout from the JSON file a person writes, and the log’s bytes by it, so that the command line, Python and a Rust program read one file into one record:

Refusals. A file is refused naming the field it fails by its path in the JSON, such as columns[2].unit, with its line and column, and a key the schema doesn’t name is refused too, so that a misspelled one isn’t silently left out. A file is at most MAX_FILE_BYTES. What the JSON can’t check, such as a unit that doesn’t measure its column’s quantity, the reader refuses when it reads the log, naming the column.

A workbook. A mapping reads a table from an .xlsx workbook’s sheet, its cells as the workbook stores them (workbook::sheets), when the caller names the sheet, from 0. A workbook read with no sheet named is refused, its sheets listed, rather than one picked.

Structs§

FipHeader
A header stated for a Featherweight Raven’s FIP export that lost its own when it was pasted into a workbook below none (ADR-274): the export’s header line, and the columns a table pasted over the export covers.
Layout
A record layout as its file states it: the fields of a record, their byte order, and for a serial console’s capture, the block the records are in.

Constants§

MAX_FILE_BYTES
The most bytes a mapping or a layout file may hold, 1 MiB: generic::MAX_COLUMNS columns or fields, each with a name of hundreds of characters, take a few tens of kilobytes.

Functions§

fip_header_from_json
Reads a FIP header file’s JSON.
header_mapping
What a table’s header states, as a mapping to edit, with a note on each column it leaves kept as written, saying why (generic::header_reading). sheet names a spreadsheet’s workbook’s sheet, .xlsx or .xls, from 0; None for a text file, or a workbook of one sheet.
json_text
A mapping’s or a layout’s file as text: UTF-8, a byte-order mark dropped, or UTF-16 with its byte-order mark, as Windows PowerShell 5.1 writes what > sends to a file; None for any other bytes, among them UTF-16 with no mark, whose zero bytes no JSON text holds.
layout_from_json
Reads a layout file’s JSON.
mapping_from_json
Reads a mapping file’s JSON.
read_by_fip_header
Reads a Raven FIP export under the header stated for it (raven::read_rows_around): the file as text, or the sheet sheet of a spreadsheet’s workbook, from 0, its cells as the workbook stores them; with no sheet chosen, a workbook’s one sheet.
read_by_layout
Reads binary records by a layout (records::read), or a serial console’s capture of them, the block the layout names (capture::read).
read_by_mapping
Reads a table by a mapping, as generic::read_with does: from a text file, or from the sheet sheet, from 0, of a spreadsheet’s workbook, .xlsx or .xls, or its one sheet.