TableConfig

Struct TableConfig 

Source
pub struct TableConfig {
Show 16 fields pub show_borders: bool, pub column_widths: Vec<usize>, pub align_right: Vec<bool>, pub border_variant: BorderVariant, pub header_separator_variant: HeaderSeparatorVariant, pub column_separator: ColumnSeparator, pub outer_padding: bool, pub inner_padding: usize, pub colorize_header: bool, pub header_color: String, pub alternating_rows: bool, pub row_color1: String, pub row_color2: String, pub min_column_width: usize, pub max_column_width: Option<usize>, pub truncation_marker: String,
}
Expand description

Formatter parameters for table output

Defines customizable parameters including borders, separators, padding, and color options. Use preset methods like bordered() or markdown() for common configurations, or customize individual parameters.

Fields§

§show_borders: bool
👎Deprecated: Use border_style instead

Show table borders (deprecated - use border_style)

§column_widths: Vec<usize>

Column widths (empty = auto-size)

§align_right: Vec<bool>

Align columns right (false = left align)

§border_variant: BorderVariant

Border rendering variant

§header_separator_variant: HeaderSeparatorVariant

Header separator line variant

§column_separator: ColumnSeparator

Column separator parameter

§outer_padding: bool

Add padding at outer edges of table

§inner_padding: usize

Number of padding spaces within cells

§colorize_header: bool

Enable ANSI coloring for header row

§header_color: String

ANSI color code for header (default: none)

§alternating_rows: bool

Enable alternating row colors

§row_color1: String

First row color

§row_color2: String

Second row color (for alternating)

§min_column_width: usize

Minimum width for each column

§max_column_width: Option<usize>

Maximum width for columns (None = unlimited)

§truncation_marker: String

Marker string for truncated content

Implementations§

Source§

impl TableConfig

Source

pub fn new() -> Self

Create new config with defaults

Source

pub fn show_borders(self, show: bool) -> Self

👎Deprecated: Use border_variant() instead

Set whether to show table borders

Source

pub fn column_widths(self, widths: Vec<usize>) -> Self

Set column widths (empty = auto-size)

Source

pub fn align_right(self, align: Vec<bool>) -> Self

Set column alignment (true = right, false = left)

Source

pub fn plain() -> Self

Plain variant: space-separated with dash separator (default) Ideal for CLI tools output (ps, top, pmon, etc.)

Source

pub fn minimal() -> Self

Minimal variant: space-separated, no separator Maximum simplicity and information density

Source

pub fn bordered() -> Self

Bordered variant: traditional pipe-separated table PostgreSQL-style output

Source

pub fn markdown() -> Self

Markdown variant: GitHub-flavored Markdown table Ready for documentation and README files

Source

pub fn grid() -> Self

Grid variant: full ASCII box with intersections Maximum visual clarity for formal reports

Source

pub fn unicode_box() -> Self

Unicode box variant: Unicode box-drawing characters Modern, professional appearance for terminal UIs

Source

pub fn csv() -> Self

CSV variant: comma-separated values Standard format for data export and Excel import

Source

pub fn tsv() -> Self

TSV variant: tab-separated values Excel and spreadsheet compatible

Source

pub fn compact() -> Self

Compact variant: single-space separator, minimal padding Maximum information density for narrow terminals

Source

pub fn border_variant(self, variant: BorderVariant) -> Self

Set border rendering variant

Source

pub fn header_separator_variant(self, variant: HeaderSeparatorVariant) -> Self

Set header separator line variant

Source

pub fn column_separator(self, sep: ColumnSeparator) -> Self

Set column separator parameter

Source

pub fn outer_padding(self, enabled: bool) -> Self

Enable/disable padding at outer table edges

Source

pub fn inner_padding(self, spaces: usize) -> Self

Set number of padding spaces within cells

Source

pub fn colorize_header(self, enabled: bool) -> Self

Enable/disable header row coloring

Source

pub fn header_color(self, color: String) -> Self

Set ANSI color code for header row

Source

pub fn alternating_rows(self, enabled: bool) -> Self

Enable/disable alternating row colors

Source

pub fn row_colors(self, color1: String, color2: String) -> Self

Set colors for alternating rows

Source

pub fn min_column_width(self, width: usize) -> Self

Set minimum column width

Source

pub fn max_column_width(self, width: Option<usize>) -> Self

Set maximum column width (None for unlimited)

Source

pub fn truncation_marker(self, marker: String) -> Self

Set truncation marker string

Trait Implementations§

Source§

impl Clone for TableConfig

Source§

fn clone(&self) -> TableConfig

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TableConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for TableConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.