pub struct Table { /* private fields */ }Expand description
A paintable Table
The type can be thought of as Rows[Cols[Cells[Text]]], where the items inside a Cell
will be concatenated together (alowing mixed formatting to exist within a table’s cell).
Warning: do not use \t in your text, as this currently uses tabwriter under the hood.
§Examples
use termstyle::*;
let rows = vec![
// header
vec![
vec![Text::new("header1".into())],
vec![Text::new("header2".into())],
],
// row1
vec![
vec![Text::new("col1".into())],
vec![Text::new("col2".into())],
],
];
let example = Table::new(rows);
let expected = "\
header1 header2
col1 col2
";
let mut result = Vec::new();
example.paint(&mut result);
assert_eq!(expected.as_bytes(), result.as_slice());Implementations§
Trait Implementations§
impl Eq for Table
impl StructuralPartialEq for Table
Auto Trait Implementations§
impl Freeze for Table
impl RefUnwindSafe for Table
impl Send for Table
impl Sync for Table
impl Unpin for Table
impl UnwindSafe for Table
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