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§
Sourcefn get_row(&self, index: usize) -> Option<Vec<String>>
fn get_row(&self, index: usize) -> Option<Vec<String>>
Get a single row by index Returns None if the index is out of bounds
Sourcefn get_column_names(&self) -> Vec<String>
fn get_column_names(&self) -> Vec<String>
Get the column names/headers
Sourcefn get_row_count(&self) -> usize
fn get_row_count(&self) -> usize
Get the total number of rows
Sourcefn get_column_count(&self) -> usize
fn get_column_count(&self) -> usize
Get the total number of columns
Provided Methods§
Sourcefn get_visible_rows(&self, start: usize, count: usize) -> Vec<Vec<String>>
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
Sourcefn get_column_widths(&self) -> Vec<usize>
fn get_column_widths(&self) -> Vec<usize>
Get the display width for each column Used for rendering column widths in the TUI
Sourcefn get_cell_value(&self, row: usize, col: usize) -> Option<String>
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
Sourcefn get_display_value(&self, row: usize, col: usize) -> String
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
Sourcefn get_column_type(&self, _column_index: usize) -> DataType
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
Sourcefn get_column_types(&self) -> Vec<DataType>
fn get_column_types(&self) -> Vec<DataType>
Get data types for all columns Returns a vector where index corresponds to column index
Implementors§
impl DataProvider for DataView
impl DataProvider for DataTable
Implementation of DataProvider for DataTable This allows DataTable to be used wherever DataProvider trait is expected