TableData

Trait TableData 

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

    // Provided methods
    fn header(&self) -> Option<Row<'a>> { ... }
    fn footer(&self) -> Option<Row<'a>> { ... }
    fn row_height(&self, row: usize) -> u16 { ... }
    fn row_style(&self, row: usize) -> 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 some sort of vec/slice.

Required Methods§

Source

fn rows(&self) -> usize

Size of the data.

Source

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

Render the cell given by column/row.

  • ctx - a lot of context data.

Provided Methods§

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, row: usize) -> u16

Row height.

Source

fn row_style(&self, row: usize) -> Option<Style>

Row style.

Source

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

Column constraints.

Trait Implementations§

Source§

impl<'a> TableData<'a> for Box<dyn TableData<'a> + 'a>

Source§

fn rows(&self) -> usize

Size of the data.
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, row: usize) -> u16

Row height.
Source§

fn row_style(&self, row: usize) -> Option<Style>

Row style.
Source§

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

Column constraints.
Source§

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

Render the cell given by column/row. Read more

Implementations on Foreign Types§

Source§

impl<'a> TableData<'a> for Box<dyn TableData<'a> + 'a>

Source§

fn rows(&self) -> usize

Source§

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

Source§

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

Source§

fn row_height(&self, row: usize) -> u16

Source§

fn row_style(&self, row: usize) -> Option<Style>

Source§

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

Source§

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

Implementors§