pub trait RowEncoder: Send + Sync {
// Required methods
fn start_new_row(&mut self) -> Result<()>;
fn encode_field(&mut self, pos: usize, value: Datum<'_>) -> Result<()>;
fn finish_row(&mut self) -> Result<Bytes>;
fn close(&mut self) -> Result<()>;
}Expand description
An encoder to write binary row data. It’s used to write rows one by one. When writing a new row:
- call method
RowEncoder::start_new_row()to start the writing. - call method
RowEncoder::encode_field()to write the row’s field. - call method
RowEncoder::finish_row()to finish the writing and get the written row.
Required Methods§
Sourcefn start_new_row(&mut self) -> Result<()>
fn start_new_row(&mut self) -> Result<()>
Sourcefn finish_row(&mut self) -> Result<Bytes>
fn finish_row(&mut self) -> Result<Bytes>
Finish write the row, returns the written row.
Note that returned row borrows from RowEncoder’s internal buffer which is reused for subsequent rows
RowEncoder::start_new_row() should only be called after the returned row goes out of scope.
§Returns
- the written row