Trait TableModel
pub trait TableModel {
type Row;
// Required methods
fn len(&self) -> usize;
fn key_at(&self, index: usize) -> Option<u64>;
fn index_of(&self, key: u64) -> Option<usize>;
fn row_state(&self, index: usize) -> TableRowState<'_, Self::Row>;
// Provided methods
fn is_empty(&self) -> bool { ... }
fn request_range(&mut self, _range: Range<usize>) { ... }
fn poll_changed(&mut self) -> bool { ... }
fn poll_changes(&mut self) -> Vec<TableModelChange> { ... }
fn sort_by(&mut self, _column_key: &str, _ascending: bool) -> bool { ... }
fn needs_poll(&self) -> bool { ... }
}Expand description
Unopinionated backing model for very large or asynchronously populated
tables. Implementations need not keep all rows resident: DataTable
queries only the visible range plus overscan.
Required Associated Types§
type Row
Required Methods§
fn index_of(&self, key: u64) -> Option<usize>
fn index_of(&self, key: u64) -> Option<usize>
Current index for a stable key, used to preserve anchors and selection across inserts, removals, moves, and sort changes.
fn row_state(&self, index: usize) -> TableRowState<'_, Self::Row>
fn row_state(&self, index: usize) -> TableRowState<'_, Self::Row>
Return resident data or an explicit placeholder state.
Provided Methods§
fn is_empty(&self) -> bool
fn request_range(&mut self, _range: Range<usize>)
fn request_range(&mut self, _range: Range<usize>)
Opportunity to enqueue a fetch for the visible range plus overscan.
fn poll_changed(&mut self) -> bool
fn poll_changed(&mut self) -> bool
Drain model notifications. Return true after any logical order, count, key, or row-state change so the table reconciles and repaints.
fn poll_changes(&mut self) -> Vec<TableModelChange>
fn poll_changes(&mut self) -> Vec<TableModelChange>
Drain a specific model-notification batch. Existing implementations of
Self::poll_changed remain compatible and produce TableModelChange::Reset.
New asynchronous models should override this method so unchanged
retained cell controls survive background updates.
fn sort_by(&mut self, _column_key: &str, _ascending: bool) -> bool
fn sort_by(&mut self, _column_key: &str, _ascending: bool) -> bool
Apply a model-owned sort. Return true when the logical order changed synchronously or a remote sort request was accepted.
fn needs_poll(&self) -> bool
fn needs_poll(&self) -> bool
Whether the host should keep scheduling frames so poll_changed can
observe an in-flight asynchronous source.