Skip to main content

RowEncoder

Trait RowEncoder 

Source
pub trait RowEncoder {
    // Required methods
    fn begin(&mut self, columns: &[String]) -> Result<()>;
    fn write_row(&mut self, row: &Row) -> Result<()>;
    fn write_named_row(&mut self, columns: &[(String, LoraValue)]) -> Result<()>;
    fn finish(&mut self) -> Result<()>;
}
Expand description

Streaming row encoder. Implementors own the underlying writer and may flush at chunk boundaries.

Required Methods§

Source

fn begin(&mut self, columns: &[String]) -> Result<()>

Emit any header bytes the format needs (CSV header row, opening [ for the JSON array). Must be called exactly once before any write_row.

Source

fn write_row(&mut self, row: &Row) -> Result<()>

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.

Source

fn write_named_row(&mut self, columns: &[(String, LoraValue)]) -> Result<()>

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).

Source

fn finish(&mut self) -> Result<()>

Emit any trailer (closing ] for the JSON array) and flush the writer.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§