Skip to main content

RowConsumer

Trait RowConsumer 

Source
pub trait RowConsumer: Send {
    // Required methods
    fn columns(&mut self, columns: &[String]) -> Result<()>;
    fn batch(&mut self, rows: Vec<Vec<Value>>) -> Result<BatchFlow>;
}
Expand description

The caller-supplied sink for a streaming statement’s result (ADR-0682). The engine calls RowConsumer::columns exactly once, before the first batch (a RETURN * learns its columns only at its first batch, so the columns may arrive together with it), then RowConsumer::batch once per bounded batch of result rows, in row order. The consumer runs on the statement’s own thread — the connection’s query worker, or the caller’s thread where the statement itself runs inline — never concurrently with the pull that produced the batch.

Send: the statement runs on the connection’s worker thread, so the consumer crosses to it.

Required Methods§

Source

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

The result columns, once, before the first batch.

Source

fn batch(&mut self, rows: Vec<Vec<Value>>) -> Result<BatchFlow>

One bounded batch of result rows, never more than BATCH_ROWS: each row carries one value per announced column, in the columns announcement’s order.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§