1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*
* SPDX-License-Identifier: MIT
* Copyright (c) 2023 - 2026. The DeepCausality Authors and Contributors. All Rights Reserved.
*/
//! The [`TableRow`] and [`FromTableRow`] traits: a typed result row declares its column schema
//! once, on the row struct itself, so a program's column names live next to the fields they
//! describe rather than being repeated at every write site.
//!
//! `write_rows` emits the schema's names and units from `TableRow`; `read_rows` matches a file's
//! header names to the schema and delivers each row's cells to [`FromTableRow::from_cells`] in
//! schema order, regardless of the file's column order.
use crateTableScalar;
/// A typed table row: its column schema and its cells, in the working precision `Scalar`.
///
/// `SCHEMA` gives the `(name, unit)` of each column in file order; `cells` projects the row to
/// exactly `SCHEMA.len()` values in the same order (checked once at write time).
/// The read-side inverse of [`TableRow`]: reconstruct a row from cells delivered in schema order.
///
/// `read_rows` matches the file header to [`TableRow::SCHEMA`] by name and reorders the file's
/// columns into schema order before calling `from_cells`, so the index of a value in `cells` is
/// always its `SCHEMA` position, never its position in the file.