Struct term_data_table::Table
source · [−]pub struct Table<'data> {
pub has_separate_rows: bool,
pub has_top_border: bool,
pub has_bottom_border: bool,
/* private fields */
}
Expand description
A set of rows containing data
Fields
has_separate_rows: bool
Whether or not to vertically separate rows in the table.
Defaults to true
.
has_top_border: bool
Whether the table should have a top border.
Setting has_separator
to false on the first row will have the same effect as setting this
to false
Defaults to true
.
has_bottom_border: bool
Whether the table should have a bottom border
Defaults to true
.
Implementations
sourceimpl<'data> Table<'data>
impl<'data> Table<'data>
pub fn new() -> Table<'data>
pub fn from_rows(rows: Vec<Row<'data>>) -> Table<'data>
pub fn from_serde(
data: impl IntoIterator<Item = impl Serialize>
) -> Result<Self>
pub fn with_style(self, style: TableStyle) -> Self
pub fn set_style(&mut self, style: TableStyle) -> &mut Self
pub fn has_separate_rows(&self) -> bool
pub fn with_separate_rows(self, has_separate_rows: bool) -> Self
pub fn set_separate_rows(&mut self, has_separate_rows: bool) -> &mut Self
sourcepub fn for_terminal(&self) -> impl Display + '_
pub fn for_terminal(&self) -> impl Display + '_
Get the terminal width and use this for the table width.
Panics
Will panic if it cannot get the terminal width (e.g. because we aren’t in a terminal).
sourcepub fn fixed_width(&self, width: usize) -> impl Display + '_
pub fn fixed_width(&self, width: usize) -> impl Display + '_
Use a custom value for the table width
Trait Implementations
Auto Trait Implementations
impl<'data> !RefUnwindSafe for Table<'data>
impl<'data> Send for Table<'data>
impl<'data> !Sync for Table<'data>
impl<'data> Unpin for Table<'data>
impl<'data> UnwindSafe for Table<'data>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more