pub trait RowSource {
// Required methods
fn row_count(&self) -> usize;
fn row(&self, index: usize) -> Vec<Cell>;
fn column_defs(&self) -> &[ColumnDef];
// Provided methods
fn set_cell(
&mut self,
_row: usize,
_col: usize,
_value: Cell,
) -> Result<(), TableError> { ... }
fn row_height(&self, _index: usize) -> f32 { ... }
fn children(&self, _row: usize) -> Option<Vec<usize>> { ... }
fn indent_level(&self, _row: usize) -> usize { ... }
fn footer(&self) -> Option<Vec<Cell>> { ... }
}Expand description
Trait that provides rows to the table widget.
Required Methods§
Sourcefn column_defs(&self) -> &[ColumnDef]
fn column_defs(&self) -> &[ColumnDef]
Returns the column definitions (name + preferred width).
Provided Methods§
Sourcefn set_cell(
&mut self,
_row: usize,
_col: usize,
_value: Cell,
) -> Result<(), TableError>
fn set_cell( &mut self, _row: usize, _col: usize, _value: Cell, ) -> Result<(), TableError>
Attempt to set a cell value in the source.
The default implementation returns TableError::ReadOnly, marking the
source as immutable. Override this method on mutable sources to accept
edits committed from the UI.
Sourcefn row_height(&self, _index: usize) -> f32
fn row_height(&self, _index: usize) -> f32
Per-row height in logical pixels.
The default returns DEFAULT_ROW_HEIGHT (24 px) for every row,
producing a uniform-height table. Override for variable-height rows.
Sourcefn children(&self, _row: usize) -> Option<Vec<usize>>
fn children(&self, _row: usize) -> Option<Vec<usize>>
Optional children of a row, enabling tree / grouped tables.
Returns None for leaf rows and flat (non-grouped) tables (default).
Return Some(child_indices) for a row that acts as a parent node.
Sourcefn indent_level(&self, _row: usize) -> usize
fn indent_level(&self, _row: usize) -> usize
Indent level for a row in a tree / grouped table.
Returns 0 for root-level rows (default). Override to return 1 for
first-level children, 2 for grandchildren, and so on.
Optional footer (aggregate) row displayed below the data rows.
Returns None (no footer) by default. Override to return a
Vec<Cell> whose length matches column_defs().len().
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl<T: RowSource + ?Sized> RowSource for Box<T>
Blanket impl so that Box<dyn RowSource> itself implements RowSource,
enabling object-safe polymorphic table data sources.
impl<T: RowSource + ?Sized> RowSource for Box<T>
Blanket impl so that Box<dyn RowSource> itself implements RowSource,
enabling object-safe polymorphic table data sources.