pub struct TabulateOptions {Show 22 fields
pub headers: Headers,
pub table_format: TableFormatChoice,
pub float_format: FormatSpec,
pub int_format: FormatSpec,
pub num_align: Option<Alignment>,
pub str_align: Option<Alignment>,
pub missing_values: MissingValues,
pub show_index: ShowIndex,
pub disable_numparse: bool,
pub disable_numparse_columns: Option<Vec<usize>>,
pub preserve_whitespace: bool,
pub enable_widechars: bool,
pub max_col_widths: Option<Vec<Option<usize>>>,
pub max_header_col_widths: Option<Vec<Option<usize>>>,
pub col_global_align: Option<Alignment>,
pub col_align: Vec<Option<Alignment>>,
pub headers_global_align: Option<Alignment>,
pub headers_align: Vec<Option<HeaderAlignment>>,
pub row_align: Vec<Option<RowAlignment>>,
pub row_global_align: Option<RowAlignment>,
pub break_long_words: bool,
pub break_on_hyphens: bool,
}Expand description
Builder-style configuration for tabulate.
Fields§
§headers: HeadersHeader configuration.
table_format: TableFormatChoiceTable format selection (either a named format or a custom specification).
float_format: FormatSpecFloating point number formatting.
int_format: FormatSpecInteger number formatting.
num_align: Option<Alignment>Alignment for numeric columns.
str_align: Option<Alignment>Alignment for string columns.
missing_values: MissingValuesReplacement value for None/missing data.
show_index: ShowIndexIndex column behaviour.
disable_numparse: boolDisable automatic detection of numeric values.
disable_numparse_columns: Option<Vec<usize>>Disable numeric parsing for specific columns (0-indexed).
preserve_whitespace: boolPreserve the original whitespace provided in the data.
enable_widechars: boolTreat East Asian wide characters using double-width measurements.
max_col_widths: Option<Vec<Option<usize>>>Maximum column widths (if any).
max_header_col_widths: Option<Vec<Option<usize>>>Maximum header column widths (if any).
col_global_align: Option<Alignment>Alignment override applied to every column.
col_align: Vec<Option<Alignment>>Alignment overrides per column.
headers_global_align: Option<Alignment>Alignment override for header row.
headers_align: Vec<Option<HeaderAlignment>>Alignment overrides per-header cell.
row_align: Vec<Option<RowAlignment>>Alignment override applied to rows.
row_global_align: Option<RowAlignment>Alignment override applied to all rows.
break_long_words: boolControl how long words are wrapped.
break_on_hyphens: boolControl whether words can be wrapped on hyphens.
Implementations§
Source§impl TabulateOptions
impl TabulateOptions
Sourcepub fn new() -> Self
pub fn new() -> Self
Construct a new options builder with default configuration.
Examples found in repository?
3fn main() {
4 let planets = vec![
5 vec!["Planet", "Radius (km)", "Mass (10^24 kg)"],
6 vec!["Mercury", "2440", "0.330"],
7 vec!["Venus", "6052", "4.87"],
8 vec!["Earth", "6371", "5.97"],
9 vec!["Mars", "3390", "0.642"],
10 ];
11
12 let table = tabulate(
13 planets,
14 TabulateOptions::new()
15 .headers(Headers::FirstRow)
16 .table_format("grid"),
17 )
18 .expect("tabulation succeeds");
19
20 println!("{table}");
21}Sourcepub fn headers(self, headers: Headers) -> Self
pub fn headers(self, headers: Headers) -> Self
Set explicit headers.
Examples found in repository?
3fn main() {
4 let planets = vec![
5 vec!["Planet", "Radius (km)", "Mass (10^24 kg)"],
6 vec!["Mercury", "2440", "0.330"],
7 vec!["Venus", "6052", "4.87"],
8 vec!["Earth", "6371", "5.97"],
9 vec!["Mars", "3390", "0.642"],
10 ];
11
12 let table = tabulate(
13 planets,
14 TabulateOptions::new()
15 .headers(Headers::FirstRow)
16 .table_format("grid"),
17 )
18 .expect("tabulation succeeds");
19
20 println!("{table}");
21}Sourcepub fn table_format<S: Into<String>>(self, format: S) -> Self
pub fn table_format<S: Into<String>>(self, format: S) -> Self
Set table format by name.
Examples found in repository?
3fn main() {
4 let planets = vec![
5 vec!["Planet", "Radius (km)", "Mass (10^24 kg)"],
6 vec!["Mercury", "2440", "0.330"],
7 vec!["Venus", "6052", "4.87"],
8 vec!["Earth", "6371", "5.97"],
9 vec!["Mars", "3390", "0.642"],
10 ];
11
12 let table = tabulate(
13 planets,
14 TabulateOptions::new()
15 .headers(Headers::FirstRow)
16 .table_format("grid"),
17 )
18 .expect("tabulation succeeds");
19
20 println!("{table}");
21}Sourcepub fn table_format_custom(self, format: TableFormat) -> Self
pub fn table_format_custom(self, format: TableFormat) -> Self
Supply a custom TableFormat.
Sourcepub fn float_format(self, format: FormatSpec) -> Self
pub fn float_format(self, format: FormatSpec) -> Self
Set floating point format.
Sourcepub fn int_format(self, format: FormatSpec) -> Self
pub fn int_format(self, format: FormatSpec) -> Self
Set integer format.
Sourcepub fn col_global_align(self, align: Alignment) -> Self
pub fn col_global_align(self, align: Alignment) -> Self
Override alignment for all columns.
Sourcepub fn missing_value<S: Into<String>>(self, value: S) -> Self
pub fn missing_value<S: Into<String>>(self, value: S) -> Self
Set the placeholder for missing values.
Sourcepub fn missing_values<I, S>(self, values: I) -> Self
pub fn missing_values<I, S>(self, values: I) -> Self
Set per-column placeholders for missing values.
Sourcepub fn disable_numparse(self, disable: bool) -> Self
pub fn disable_numparse(self, disable: bool) -> Self
Control whether tabulate should attempt to parse numeric values.
Sourcepub fn disable_numparse_columns<I>(self, columns: I) -> Selfwhere
I: IntoIterator<Item = usize>,
pub fn disable_numparse_columns<I>(self, columns: I) -> Selfwhere
I: IntoIterator<Item = usize>,
Disable numeric parsing for specific columns (0-indexed).
Sourcepub fn is_numparse_disabled(&self, column: Option<usize>) -> bool
pub fn is_numparse_disabled(&self, column: Option<usize>) -> bool
Returns true if numeric parsing is disabled for the provided column.
Sourcepub fn preserve_whitespace(self, preserve: bool) -> Self
pub fn preserve_whitespace(self, preserve: bool) -> Self
Control whitespace preservation.
Sourcepub fn enable_widechars(self, enable: bool) -> Self
pub fn enable_widechars(self, enable: bool) -> Self
Enable width calculations that treat East Asian wide characters as double width.
Sourcepub fn show_index(self, show_index: ShowIndex) -> Self
pub fn show_index(self, show_index: ShowIndex) -> Self
Configure how the index column is displayed.
Sourcepub fn max_col_widths(self, widths: Vec<Option<usize>>) -> Self
pub fn max_col_widths(self, widths: Vec<Option<usize>>) -> Self
Set per-column maximum widths. Use None for columns without limits.
Sourcepub fn max_col_width(self, width: usize) -> Self
pub fn max_col_width(self, width: usize) -> Self
Set the same maximum width for all columns.
Sourcepub fn max_header_col_widths(self, widths: Vec<Option<usize>>) -> Self
pub fn max_header_col_widths(self, widths: Vec<Option<usize>>) -> Self
Set per-column maximum header widths. Use None for unlimited columns.
Sourcepub fn max_header_col_width(self, width: usize) -> Self
pub fn max_header_col_width(self, width: usize) -> Self
Set the same maximum width for all header columns.
Sourcepub fn headers_mapping<I, K, V>(self, mapping: I) -> Self
pub fn headers_mapping<I, K, V>(self, mapping: I) -> Self
Provide a mapping from column keys to display headers.
Sourcepub fn col_alignments<I>(self, aligns: I) -> Self
pub fn col_alignments<I>(self, aligns: I) -> Self
Provide per-column alignment overrides.
Sourcepub fn headers_global_align(self, align: Alignment) -> Self
pub fn headers_global_align(self, align: Alignment) -> Self
Override alignment for all headers.
Sourcepub fn headers_alignments<I>(self, aligns: I) -> Self
pub fn headers_alignments<I>(self, aligns: I) -> Self
Provide per-header alignment overrides.
Sourcepub fn row_global_align(self, align: RowAlignment) -> Self
pub fn row_global_align(self, align: RowAlignment) -> Self
Override the default alignment for all data rows.
Sourcepub fn row_alignments<I>(self, aligns: I) -> Self
pub fn row_alignments<I>(self, aligns: I) -> Self
Provide per-row alignment overrides.
Trait Implementations§
Source§impl Clone for TabulateOptions
impl Clone for TabulateOptions
Source§fn clone(&self) -> TabulateOptions
fn clone(&self) -> TabulateOptions
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more