pub trait RowEncoder {
// Required methods
fn begin(&mut self, columns: &[String]) -> Result<(), Error>;
fn write_row(&mut self, row: &Row) -> Result<(), Error>;
fn write_named_row(
&mut self,
columns: &[(String, LoraValue)],
) -> Result<(), Error>;
fn finish(&mut self) -> Result<(), Error>;
}Expand description
Streaming row encoder. Implementors own the underlying writer and may flush at chunk boundaries.
Required Methods§
Sourcefn begin(&mut self, columns: &[String]) -> Result<(), Error>
fn begin(&mut self, columns: &[String]) -> Result<(), Error>
Emit any header bytes the format needs (CSV header row,
opening [ for the JSON array). Must be called exactly once
before any write_row.
Sourcefn write_row(&mut self, row: &Row) -> Result<(), Error>
fn write_row(&mut self, row: &Row) -> Result<(), Error>
Write one row. The encoder pulls column names from the row’s
Row::iter_named iterator — they must align with the
columns passed to Self::begin, in the same order, for CSV.
Sourcefn write_named_row(
&mut self,
columns: &[(String, LoraValue)],
) -> Result<(), Error>
fn write_named_row( &mut self, columns: &[(String, LoraValue)], ) -> Result<(), Error>
Write the same shape as Self::write_row from a flat
(name, value) slice. Used by encoders that consume rows
from outside the engine (testing, replay).