Skip to main content

DataSource

Trait DataSource 

Source
pub trait DataSource {
    // Required methods
    fn schema(&self) -> &[ColumnSchema];
    fn row_count(&self) -> usize;
    fn read_range(&self, range: Range<usize>) -> Result<Dataset, DataError>;

    // Provided methods
    fn revision(&self) -> u64 { ... }
    fn cancel(&self) { ... }
}
Available on crate feature data only.
Expand description

A lazy, paged table. A source can be backed by a file, a database, a channel, or a thread; the trait is synchronous and never pulls in an async runtime.

§Example

use crisol_core::data::DataSource;

Required Methods§

Source

fn schema(&self) -> &[ColumnSchema]

The column schema.

Source

fn row_count(&self) -> usize

The total number of rows, when known.

Source

fn read_range(&self, range: Range<usize>) -> Result<Dataset, DataError>

Read rows in range. Implementations may return fewer rows at the end.

§Errors

When the range is invalid or the backing store fails.

Provided Methods§

Source

fn revision(&self) -> u64

A revision that changes when the source changes.

Source

fn cancel(&self)

Cancel an in-flight read, when the implementation supports it.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§