pub struct Table<'a, H, R> { /* private fields */ }Expand description
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(&[Constraint::Length(5), Constraint::Length(5), Constraint::Length(10)])
.style(Style::default().fg(Color::White))
.column_spacing(1);Implementations§
Source§impl<'a, H, D, R> Table<'a, H, R>
impl<'a, H, D, R> Table<'a, H, R>
pub fn new(header: H, rows: R) -> Table<'a, H, R>
pub fn block(self, block: Block<'a>) -> Table<'a, H, R>
pub fn header<II>(self, header: II) -> Table<'a, H, R>where
II: IntoIterator<Item = H::Item, IntoIter = H>,
pub fn header_style(self, style: Style) -> Table<'a, H, R>
pub fn widths(self, widths: &'a [Constraint]) -> Table<'a, H, R>
pub fn rows<II>(self, rows: II) -> Table<'a, H, R>where
II: IntoIterator<Item = Row<D>, IntoIter = R>,
pub fn style(self, style: Style) -> Table<'a, H, R>
pub fn highlight_symbol(self, highlight_symbol: &'a str) -> Table<'a, H, R>
pub fn highlight_style(self, highlight_style: Style) -> Table<'a, H, R>
pub fn column_spacing(self, spacing: u16) -> Table<'a, H, R>
pub fn header_gap(self, gap: u16) -> Table<'a, H, R>
Trait Implementations§
Source§impl<'a, H, D, R> StatefulWidget for Table<'a, H, R>
impl<'a, H, D, R> StatefulWidget for Table<'a, H, R>
Auto Trait Implementations§
impl<'a, H, R> Freeze for Table<'a, H, R>
impl<'a, H, R> RefUnwindSafe for Table<'a, H, R>where
H: RefUnwindSafe,
R: RefUnwindSafe,
impl<'a, H, R> Send for Table<'a, H, R>
impl<'a, H, R> Sync for Table<'a, H, R>
impl<'a, H, R> Unpin for Table<'a, H, R>
impl<'a, H, R> UnsafeUnpin for Table<'a, H, R>where
H: UnsafeUnpin,
R: UnsafeUnpin,
impl<'a, H, R> UnwindSafe for Table<'a, H, R>where
H: UnwindSafe,
R: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more