pub trait AsyncRowSource: Send {
// Required methods
fn row_count(&self) -> usize;
fn column_defs(&self) -> &[ColumnDef];
fn row_async(
&self,
index: usize,
) -> BoxFuture<'_, Result<Vec<Cell>, TableError>>;
// Provided methods
fn row_height(&self, _index: usize) -> f32 { ... }
fn footer_async(&self) -> BoxFuture<'_, Option<Vec<Cell>>> { ... }
}Expand description
Asynchronous variant of RowSource for IO-bound data backends.
Implement this trait for data sources that cannot materialise rows synchronously (e.g. remote databases, networked APIs, lazy disk reads).
§Usage
Wrap an AsyncRowSource in a PrefetchBuffer to obtain a synchronous
RowSource that serves rows from cache while background prefetch
keeps the buffer warm.
§Thread safety
Implementors are only required to be Send. The PrefetchBuffer
wraps the source in an Arc and accesses it exclusively from the async
prefetch path, which runs on a single task at a time.
Required Methods§
Sourcefn row_count(&self) -> usize
fn row_count(&self) -> usize
Total number of rows available in the source.
This count is used to size scroll bars and paginate navigation.
Sourcefn column_defs(&self) -> &[ColumnDef]
fn column_defs(&self) -> &[ColumnDef]
Return the column definitions for this source.
Provided Methods§
Sourcefn row_height(&self, _index: usize) -> f32
fn row_height(&self, _index: usize) -> f32
Per-row height in logical pixels.
Defaults to DEFAULT_ROW_HEIGHT (24 px) for every row.
Optional footer row (aggregate / summary).
Fetched once and cached; invalidate by rebuilding the PrefetchBuffer.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".