pub(crate) struct CsvRowWriter {
pub(crate) timestamps: Rfc3339Formatter,
pub(crate) values: ValueTextCache,
pub(crate) channel_field: Vec<u8>,
}Expand description
Writes export CSV rows into a chunk buffer.
A row is <timestamp>,chNN,<raw_value>,<calibrated_value>,<calibration_id>, plus
,<filtered_value> in a filtered export, then \n: byte for byte what
writeln! with {} for every field gives (floats in Rust’s default Display
format, the filtered value empty when it is not finite). It formats the
timestamp with Rfc3339Formatter and the values through ValueTextCache,
and builds ,chNN, once per channel, so a row normally costs no allocation and
at most one float formatting (the filtered value).
Fields§
§timestamps: Rfc3339FormatterTimestamp formatter, shared by every row of the export.
values: ValueTextCacheRecent raw,calibrated texts.
channel_field: Vec<u8>,chNN, of the channel being written.
Implementations§
Source§impl CsvRowWriter
impl CsvRowWriter
Sourcepub(crate) fn new() -> Self
pub(crate) fn new() -> Self
Creates a writer; call Self::set_channel before the first row.
Sourcepub(crate) fn set_channel(&mut self, channel: u8)
pub(crate) fn set_channel(&mut self, channel: u8)
Sets the channel written in the following rows.
Sourcepub(crate) fn write_row(
&mut self,
out: &mut Vec<u8>,
timestamp_unix_ns: i64,
raw_value: f64,
spec: &CalibrationSpec,
calibration_id: &str,
filtered: FilteredColumn,
)
pub(crate) fn write_row( &mut self, out: &mut Vec<u8>, timestamp_unix_ns: i64, raw_value: f64, spec: &CalibrationSpec, calibration_id: &str, filtered: FilteredColumn, )
Appends one row to out.
§Arguments
out- Chunk buffer.timestamp_unix_ns- Sample time.raw_value- Value stored in the Parquet file.spec- Calibration of the row’s file.calibration_id- Calibration id written in the fifth column.filtered- Thefiltered_valuecolumn, if any.