TableDataIter

Trait TableDataIter 

Source
pub trait TableDataIter<'a> {
    // Required methods
    fn rows(&self) -> Option<usize>;
    fn nth(&mut self, n: usize) -> bool;
    fn render_cell(
        &self,
        ctx: &TableContext,
        column: usize,
        area: Rect,
        buf: &mut Buffer,
    );

    // Provided methods
    fn cloned(&self) -> Option<Box<dyn TableDataIter<'a> + 'a>> { ... }
    fn header(&self) -> Option<Row<'a>> { ... }
    fn footer(&self) -> Option<Row<'a>> { ... }
    fn row_height(&self) -> u16 { ... }
    fn row_style(&self) -> Option<Style> { ... }
    fn widths(&self) -> Vec<Constraint> { ... }
}
Expand description

Trait for accessing the table-data by the Table.

This trait is suitable if the underlying data is an iterator.

Required Methods§

Source

fn rows(&self) -> Option<usize>

Returns the number of rows, if known.

If they are not known, all items will be iterated to calculate things as the length of the table. Which will be slower if you have many items.

See Table::no_row_count

Source

fn nth(&mut self, n: usize) -> bool

Skips to the nth item, returns true if such an item exists. nth(0) == next()

Source

fn render_cell( &self, ctx: &TableContext, column: usize, area: Rect, buf: &mut Buffer, )

Render the cell for the current line.

  • ctx - a lot of context data.

Provided Methods§

Source

fn cloned(&self) -> Option<Box<dyn TableDataIter<'a> + 'a>>

StatefulWidgetRef needs a clone of the iterator for every render. For StatefulWidget this is not needed at all. So this defaults to None and warns at runtime.

Source

fn header(&self) -> Option<Row<'a>>

Header can be obtained from here. Alternative to setting on Table.

Source

fn footer(&self) -> Option<Row<'a>>

Footer can be obtained from here. Alternative to setting on Table.

Source

fn row_height(&self) -> u16

Row height for the current item.

Source

fn row_style(&self) -> Option<Style>

Row style for the current line.

Source

fn widths(&self) -> Vec<Constraint>

Column constraints.

Implementors§