Trait rat_ftable::TableDataIter

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

    // Provided methods
    fn header(&self) -> Option<Row<'a>> { ... }
    fn footer(&self) -> Option<Row<'a>> { ... }
    fn next(&mut self) -> bool { ... }
    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 FTable.

This trait is suitable if the underlying data is an iterator. It uses internal iteration which allows much more leeway with borrowing & lifetimes.

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.

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, column: usize, area: Rect, buf: &mut Buffer)

Render the cell for the current line.

Provided Methods§

source

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

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

source

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

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

source

fn next(&mut self) -> bool

Reads the next item, returns true if such an item exists.

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§