[][src]Struct tui::widgets::Table

pub struct Table<'a, T, H, I, D, R> where
    T: Display,
    H: Iterator<Item = T>,
    I: Display,
    D: Iterator<Item = I>,
    R: Iterator<Item = Row<D, I>>, 
{ /* fields omitted */ }

A widget to display data in formatted columns

Examples

let row_style = Style::default().fg(Color::White);
Table::new(
        ["Col1", "Col2", "Col3"].into_iter(),
        vec![
            Row::StyledData(["Row11", "Row12", "Row13"].into_iter(), row_style),
            Row::StyledData(["Row21", "Row22", "Row23"].into_iter(), row_style),
            Row::StyledData(["Row31", "Row32", "Row33"].into_iter(), row_style),
            Row::Data(["Row41", "Row42", "Row43"].into_iter())
        ].into_iter()
    )
    .block(Block::default().title("Table"))
    .header_style(Style::default().fg(Color::Yellow))
    .widths(&[5, 5, 10])
    .style(Style::default().fg(Color::White))
    .column_spacing(1);

Methods

impl<'a, T, H, I, D, R> Table<'a, T, H, I, D, R> where
    T: Display,
    H: Iterator<Item = T>,
    I: Display,
    D: Iterator<Item = I>,
    R: Iterator<Item = Row<D, I>>, 
[src]

pub fn new(header: H, rows: R) -> Table<'a, T, H, I, D, R>[src]

pub fn block(self, block: Block<'a>) -> Table<'a, T, H, I, D, R>[src]

pub fn header<II>(self, header: II) -> Table<'a, T, H, I, D, R> where
    II: IntoIterator<Item = T, IntoIter = H>, 
[src]

pub fn header_style(self, style: Style) -> Table<'a, T, H, I, D, R>[src]

pub fn widths(self, widths: &'a [u16]) -> Table<'a, T, H, I, D, R>[src]

pub fn rows<II>(self, rows: II) -> Table<'a, T, H, I, D, R> where
    II: IntoIterator<Item = Row<D, I>, IntoIter = R>, 
[src]

pub fn style(self, style: Style) -> Table<'a, T, H, I, D, R>[src]

pub fn column_spacing(self, spacing: u16) -> Table<'a, T, H, I, D, R>[src]

Trait Implementations

impl<'a, T, H, I, D, R> Widget for Table<'a, T, H, I, D, R> where
    T: Display,
    H: Iterator<Item = T>,
    I: Display,
    D: Iterator<Item = I>,
    R: Iterator<Item = Row<D, I>>, 
[src]

fn background(&self, area: Rect, buf: &mut Buffer, color: Color)[src]

Helper method to quickly set the background of all cells inside the specified area.

fn render<B>(&mut self, f: &mut Frame<B>, area: Rect) where
    Self: Sized,
    B: Backend
[src]

Helper method that can be chained with a widget's builder methods to render it.

impl<'a, T, H, I, D, R> Default for Table<'a, T, H, I, D, R> where
    T: Display,
    H: Iterator<Item = T> + Default,
    I: Display,
    D: Iterator<Item = I>,
    R: Iterator<Item = Row<D, I>> + Default
[src]

Auto Trait Implementations

impl<'a, T, H, I, D, R> Send for Table<'a, T, H, I, D, R> where
    H: Send,
    R: Send

impl<'a, T, H, I, D, R> Sync for Table<'a, T, H, I, D, R> where
    H: Sync,
    R: Sync

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]