pub trait TableProvider {
// Required methods
fn headers(&self) -> &[&str];
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 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 { ... }
}Required Methods§
fn headers(&self) -> &[&str]
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§
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".