DataProvider

Trait DataProvider 

Source
pub trait DataProvider:
    Send
    + Sync
    + Debug {
    // Required methods
    fn get_row(&self, index: usize) -> Option<Vec<String>>;
    fn get_column_names(&self) -> Vec<String>;
    fn get_row_count(&self) -> usize;
    fn get_column_count(&self) -> usize;

    // Provided methods
    fn get_visible_rows(&self, start: usize, count: usize) -> Vec<Vec<String>> { ... }
    fn get_column_widths(&self) -> Vec<usize> { ... }
    fn get_cell_value(&self, row: usize, col: usize) -> Option<String> { ... }
    fn get_display_value(&self, row: usize, col: usize) -> String { ... }
    fn get_column_type(&self, _column_index: usize) -> DataType { ... }
    fn get_column_types(&self) -> Vec<DataType> { ... }
}
Expand description

Core trait for read-only data access

This trait defines the minimal interface that any data source must provide to be usable by the TUI for rendering and display.

Required Methods§

Source

fn get_row(&self, index: usize) -> Option<Vec<String>>

Get a single row by index Returns None if the index is out of bounds

Source

fn get_column_names(&self) -> Vec<String>

Get the column names/headers

Source

fn get_row_count(&self) -> usize

Get the total number of rows

Source

fn get_column_count(&self) -> usize

Get the total number of columns

Provided Methods§

Source

fn get_visible_rows(&self, start: usize, count: usize) -> Vec<Vec<String>>

Get multiple rows for efficient rendering This is an optimization to avoid multiple get_row calls

Source

fn get_column_widths(&self) -> Vec<usize>

Get the display width for each column Used for rendering column widths in the TUI

Source

fn get_cell_value(&self, row: usize, col: usize) -> Option<String>

Get a single cell value Returns None if row or column index is out of bounds

Source

fn get_display_value(&self, row: usize, col: usize) -> String

Get a display-formatted cell value Returns empty string if indices are out of bounds

Source

fn get_column_type(&self, _column_index: usize) -> DataType

Get the data type of a specific column This should be cached/determined at load time, not computed on each call

Source

fn get_column_types(&self) -> Vec<DataType>

Get data types for all columns Returns a vector where index corresponds to column index

Implementors§

Source§

impl DataProvider for BufferAdapter<'_>

Source§

impl DataProvider for CsvClientAdapter<'_>

Source§

impl DataProvider for DataView

Source§

impl DataProvider for DataTable

Implementation of DataProvider for DataTable This allows DataTable to be used wherever DataProvider trait is expected