Skip to main content

RowSource

Trait RowSource 

Source
pub trait RowSource {
    // Required methods
    fn columns(&self) -> &[String];
    fn next_row(&mut self) -> Option<Result<Row, DataError>>;

    // Provided methods
    fn schema(&self) -> Option<&Schema> { ... }
    fn collect_rows(self) -> Result<Rows, DataError>
       where Self: Sized { ... }
}
Expand description

The row source contract: column names, an optional schema, and rows.

A source yields rows one at a time, so a renderer or a profile can stop early or hold one window of a long input; collect_rows reads the rest into Rows. Every row a source yields has exactly one cell per column.

Required Methods§

Source

fn columns(&self) -> &[String]

The column names, in order.

Source

fn next_row(&mut self) -> Option<Result<Row, DataError>>

The next row, None at the end, or why it could not be read.

Provided Methods§

Source

fn schema(&self) -> Option<&Schema>

What the source knows about the columns’ types, if anything. A source’s schema has one field per column, in the same order.

Source

fn collect_rows(self) -> Result<Rows, DataError>
where Self: Sized,

Read every remaining row into memory.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§