pub trait TableProvider {
Show 16 methods
// Required methods
fn column_count(&self) -> usize;
fn header(&self, index: usize) -> Option<Cow<'_, str>>;
fn headers(&self) -> HeaderIter<'_> ⓘ;
fn row_count(&self) -> usize;
fn for_selected_rows(
&self,
state: &TableState,
f: &mut RowCallback<'_>,
) -> Result<(), TableError>;
fn for_all_rows(&self, f: &mut RowCallback<'_>) -> Result<(), TableError>;
// Provided methods
fn cell_at(
&self,
row_index: usize,
col_index: usize,
) -> Result<Option<TableCell<'_>>, TableError> { ... }
fn for_row_at(
&self,
index: usize,
f: &mut RowCallback<'_>,
) -> Result<(), TableError> { ... }
fn row_at(&self, index: usize) -> Result<Option<OwnedRow>, TableError> { ... }
fn sort_active_rows(
&self,
active_rows: &mut Vec<usize>,
col_index: usize,
ascending: bool,
) -> Result<(), TableError> { ... }
fn filter_rows(
&self,
state: &TableState,
filters: &[(usize, Filter)],
) -> Result<Vec<usize>, TableError> { ... }
fn row_hierarchy(
&self,
_state: &TableState,
_row_index: usize,
) -> Option<RowHierarchy> { ... }
fn is_tree(&self) -> bool { ... }
fn row_parent(&self, _row_index: usize) -> Option<usize> { ... }
fn row_children(&self, _row_index: usize) -> Vec<usize> { ... }
fn row_matches(
&self,
_state: &TableState,
_row_index: usize,
_filters: &[(usize, Filter)],
_highlight: Option<u8>,
) -> bool { ... }
}Expand description
Trait implemented by datasets to back the interactive table system.
Required Methods§
fn column_count(&self) -> usize
fn header(&self, index: usize) -> Option<Cow<'_, str>>
fn headers(&self) -> HeaderIter<'_> ⓘ
fn row_count(&self) -> usize
Sourcefn for_selected_rows(
&self,
state: &TableState,
f: &mut RowCallback<'_>,
) -> Result<(), TableError>
fn for_selected_rows( &self, state: &TableState, f: &mut RowCallback<'_>, ) -> Result<(), TableError>
Sequentially processes each selected row with the provided callback.
Sourcefn for_all_rows(&self, f: &mut RowCallback<'_>) -> Result<(), TableError>
fn for_all_rows(&self, f: &mut RowCallback<'_>) -> Result<(), TableError>
Sequentially processes every row in the dataset.
Provided Methods§
Sourcefn cell_at(
&self,
row_index: usize,
col_index: usize,
) -> Result<Option<TableCell<'_>>, TableError>
fn cell_at( &self, row_index: usize, col_index: usize, ) -> Result<Option<TableCell<'_>>, TableError>
Direct cellular random-access method.
Override this in your custom collections to achieve O(1) performance and completely bypass heap-allocation pathways during rendering.
Sourcefn for_row_at(
&self,
index: usize,
f: &mut RowCallback<'_>,
) -> Result<(), TableError>
fn for_row_at( &self, index: usize, f: &mut RowCallback<'_>, ) -> Result<(), TableError>
Processes a single row by index. Override this for O(1) random access.
Sourcefn row_at(&self, index: usize) -> Result<Option<OwnedRow>, TableError>
fn row_at(&self, index: usize) -> Result<Option<OwnedRow>, TableError>
Randomly fetches a single row as an OwnedRow. This is the access path used
by the rendering delegate for visible rows.
The default implementation walks the dataset sequentially (O(N)) and should be overridden for true O(1) random access whenever the backing store supports it.
Sourcefn sort_active_rows(
&self,
active_rows: &mut Vec<usize>,
col_index: usize,
ascending: bool,
) -> Result<(), TableError>
fn sort_active_rows( &self, active_rows: &mut Vec<usize>, col_index: usize, ascending: bool, ) -> Result<(), TableError>
Sorts the active row indices by the specified column. Uses a generic string-based fallback sorting implementation, but can be overridden.
Sourcefn filter_rows(
&self,
state: &TableState,
filters: &[(usize, Filter)],
) -> Result<Vec<usize>, TableError>
fn filter_rows( &self, state: &TableState, filters: &[(usize, Filter)], ) -> Result<Vec<usize>, TableError>
Filters all rows sequentially. Override this to implement custom parallel filtering (e.g. Rayon).
Sourcefn row_hierarchy(
&self,
_state: &TableState,
_row_index: usize,
) -> Option<RowHierarchy>
fn row_hierarchy( &self, _state: &TableState, _row_index: usize, ) -> Option<RowHierarchy>
Returns tree nesting parameters for a given row.
Evaluates to None by default (representing traditional non-hierarchical flat tables).
Sourcefn is_tree(&self) -> bool
fn is_tree(&self) -> bool
Returns whether this provider represents a hierarchical tree table.
Returns false by default.
Sourcefn row_parent(&self, _row_index: usize) -> Option<usize>
fn row_parent(&self, _row_index: usize) -> Option<usize>
Returns the active parent row index for a given row (if any).
Sourcefn row_children(&self, _row_index: usize) -> Vec<usize>
fn row_children(&self, _row_index: usize) -> Vec<usize>
Returns the child row indices nested immediately under the specified row.
Sourcefn row_matches(
&self,
_state: &TableState,
_row_index: usize,
_filters: &[(usize, Filter)],
_highlight: Option<u8>,
) -> bool
fn row_matches( &self, _state: &TableState, _row_index: usize, _filters: &[(usize, Filter)], _highlight: Option<u8>, ) -> bool
Returns whether an individual row matches the currently active column filters.
Implementations§
Source§impl dyn TableProvider + '_
impl dyn TableProvider + '_
Sourcepub fn map_selected_rows<T, F>(
&self,
state: &TableState,
f: F,
) -> Result<Vec<T>, TableError>
pub fn map_selected_rows<T, F>( &self, state: &TableState, f: F, ) -> Result<Vec<T>, TableError>
Maps over each selected row with a closure and collects the results into a flat Vector.
Sourcepub fn map_first_selected_row<T, F>(
&self,
state: &TableState,
f: F,
) -> Result<Option<T>, TableError>
pub fn map_first_selected_row<T, F>( &self, state: &TableState, f: F, ) -> Result<Option<T>, TableError>
Maps only the first selected row (if any) and returns the result, stopping iteration immediately.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".