Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/Nukesor/comfy-table
/ functions
Functions
261 in github.com/Nukesor/comfy-table
⨍
Functions
261
◇
Types & classes
18
↓ 56 callers
Method
add_row
Add a new row to the table. ``` use comfy_table::{Row, Table}; let mut table = Table::new(); table.add_row(vec!["One", "Two"]); ```
src/table.rs:143
↓ 50 callers
Method
set_header
Set the header row of the table. This is usually the title of each column.\ There'll be no header unless you explicitly set it with this function. ``
src/table.rs:108
↓ 39 callers
Method
set_content_arrangement
Specify how Comfy Table should arrange the content in your table. ``` use comfy_table::{ContentArrangement, Table}; let mut table = Table::new(); ta
src/table.rs:292
↓ 38 callers
Method
set_width
Enforce a max width that should be used in combination with [dynamic content arrangement](ContentArrangement::Dynamic).\ This is usually not necessary
src/table.rs:250
↓ 28 callers
Method
load_style
Load a [TableStyle] for this table, replacing the current style. \ Preset styles can be found in the [presets](crate::style::presets) module. You can
src/table.rs:453
↓ 16 callers
Function
assert_table_line_width
(table: &Table, count: usize)
tests/all/mod.rs:26
↓ 13 callers
Function
get_preset_table
()
tests/all/presets_test.rs:4
↓ 13 callers
Method
width
(&self)
src/utils/mod.rs:44
↓ 12 callers
Method
set_constraints
Convenience method to set a [ColumnConstraint] for all columns at once. Constraints are used to influence the way the columns will be arranged. Check
src/table.rs:426
↓ 9 callers
Method
column_mut
Get a mutable reference to a specific column.
src/table.rs:499
↓ 9 callers
Method
next
(&mut self)
src/table.rs:701
↓ 8 callers
Method
set_constraint
Constraints allow to influence the auto-adjustment behavior of columns.\ This can be useful to counter undesired auto-adjustment of content in tables.
src/column.rs:83
↓ 7 callers
Method
force_no_tty
(&mut self)
src/table.rs:334
↓ 7 callers
Function
get_constraint_table
()
tests/all/constraints_test.rs:6
↓ 7 callers
Method
max_height
Truncate content of cells which occupies more than X lines of space. At least one line of content is always shown, hence a value of `0` is implicitly
src/row.rs:54
↓ 6 callers
Method
lines
This is an alternative to `fmt`, but rather returns an iterator to each line, rather than one String separated by newlines.
src/table.rs:94
↓ 5 callers
Method
add_row_if
Add a new row to the table if the predicate evaluates to `true`. ``` use comfy_table::{Row, Table}; let mut table = Table::new(); table.add_row_if(|
src/table.rs:160
↓ 5 callers
Method
column_iter
Iterator over all columns
src/table.rs:504
↓ 5 callers
Method
enforce_styling
(&mut self)
src/table.rs:382
↓ 5 callers
Function
max
A little wrapper, which resolves possible upper boundary constraints to their actual value for the current table and terminal width. This returns the
src/utils/arrangement/constraint.rs:88
↓ 5 callers
Function
should_draw_left_border
(table: &Table)
src/utils/formatting/borders.rs:206
↓ 5 callers
Function
should_draw_right_border
(table: &Table)
src/utils/formatting/borders.rs:210
↓ 4 callers
Function
absolute_value_from_width
Resolve an absolute value from a given boundary
src/utils/arrangement/constraint.rs:108
↓ 4 callers
Function
absolute_width_with_padding
The ColumnDisplayInfo works with a fixed value for content width. However, if a column is supposed to get a absolute width, we have to make sure that
src/utils/arrangement/helper.rs:15
↓ 4 callers
Method
add_cell
Add a cell to the row. Attention: If a row has already been added to a table and you add more cells to it than there're columns currently know to the
src/row.rs:37
↓ 4 callers
Method
add_rows
Add multiple rows to the table. ``` use comfy_table::{Row, Table}; let mut table = Table::new(); let rows = vec![vec!["One", "Two"], vec!["Three", "
src/table.rs:181
↓ 4 callers
Method
add_rows_if
Add multiple rows to the table if the predicate evaluates to `true`. ``` use comfy_table::{Row, Table}; let mut table = Table::new(); let rows = vec
src/table.rs:205
↓ 4 callers
Method
is_decided
Whether this column already has a decided width.
src/utils/arrangement/dynamic.rs:89
↓ 4 callers
Method
is_empty
Returns if the table is empty (contains no data rows). ``` use comfy_table::Table; let mut table = Table::new(); assert!(table.is_empty()); table.a
src/table.rs:243
↓ 4 callers
Method
is_hidden
Returns weather the columns is hidden via [ColumnConstraint::Hidden].
src/column.rs:102
↓ 4 callers
Method
is_visible
(&self)
src/style/table_style.rs:70
↓ 4 callers
Function
measure_text_width
(s: &str)
src/utils/formatting/content_split/normal.rs:8
↓ 4 callers
Method
set_padding
Set the padding for all cells of this column. Padding is provided in the form of (left, right).\ Default is `(1, 1)`.
src/column.rs:59
↓ 3 callers
Method
autogenerate_columns
Autogenerate new columns, if a row is added with more cells than existing columns.
src/table.rs:662
↓ 3 callers
Method
average_space
The average remaining space per undecided column. Returns 0 if no undecided columns remain.
src/utils/arrangement/dynamic.rs:82
↓ 3 callers
Method
column_iter_mut
Get a mutable iterator over all columns. ``` use comfy_table::{ColumnConstraint::*, Table, Width::*}; let mut table = Table::new(); table.add_row(&v
src/table.rs:532
↓ 3 callers
Function
count_border_columns
Return the amount of border columns, that will be visible in the final table output.
src/utils/arrangement/helper.rs:41
↓ 3 callers
Method
fix_column
Fix `column` to `content_width` and adjust `remaining_width` and `remaining_columns` accordingly. Returns `false` when no undecided columns remain af
src/utils/arrangement/dynamic.rs:96
↓ 3 callers
Function
get_preset_table
()
tests/all/styling_test.rs:4
↓ 3 callers
Function
get_preset_table
()
tests/all/inner_style_test.rs:4
↓ 3 callers
Function
get_table
()
tests/all/hidden_test.rs:4
↓ 3 callers
Function
min
A little wrapper, which resolves possible lower boundary constraints to their actual value for the current table and terminal width. This returns the
src/utils/arrangement/constraint.rs:62
↓ 3 callers
Method
padding_width
Convenience helper that returns the total width of the combined padding.
src/column.rs:66
↓ 3 callers
Method
row_iter_mut
Get a mutable iterator over all rows. ``` use comfy_table::Table; let mut table = Table::new(); table.add_row(&vec!["First", "Second", "Third"]); //
src/table.rs:624
↓ 3 callers
Function
should_draw_vertical_lines
(table: &Table)
src/utils/formatting/borders.rs:214
↓ 2 callers
Function
absolute_width
(table: &Table, width: &Width)
tests/all/property_test.rs:549
↓ 2 callers
Function
arrange_content
Top level entry point for content arrangement.
src/utils/arrangement/mod.rs:14
↓ 2 callers
Method
cell_count
Get the amount of cells on this row.
src/row.rs:78
↓ 2 callers
Method
cell_iter
Returns an iterator over all cells of this row
src/row.rs:83
↓ 2 callers
Method
column_max_content_widths
Return a vector representing the maximum amount of characters in any line of this column.\ Attention** This scans the whole current content of the ta
src/table.rs:631
↓ 2 callers
Method
constraint
Get the constraint that is used for this column.
src/column.rs:90
↓ 2 callers
Method
content_lines
Set the style of the lines that contain the rows' content.
src/style/table_style.rs:208
↓ 2 callers
Method
discover_columns
Calling this might be necessary if you add new cells to rows that're already added to the table. If more cells than're currently know to the table ar
src/table.rs:679
↓ 2 callers
Function
even_widths
Split `width` into `count` relatively equal chunks. Since we do integer division, there is most likely a little bit of non equally-divisible space. W
src/utils/arrangement/dynamic.rs:491
↓ 2 callers
Method
fill
Set the fill character.
src/style/table_style.rs:53
↓ 2 callers
Function
fix_style_in_split_str
Fixes ansi escape codes in a split string 1. Adds reset code to the end of each substring if needed. 2. Keeps track of previous substring's escape cod
src/utils/formatting/content_split/custom_styling.rs:133
↓ 2 callers
Function
get_preset_table
()
tests/all/modifiers_test.rs:4
↓ 2 callers
Method
header
(&self)
src/table.rs:116
↓ 2 callers
Method
header_lines
Set the style of the lines that contain the header's content.
src/style/table_style.rs:196
↓ 2 callers
Method
header_separator
Set the line that's drawn between the header and the first row.
src/style/table_style.rs:202
↓ 2 callers
Method
is_tty
(&self)
src/table.rs:355
↓ 2 callers
Method
left
Set the left border character.
src/style/table_style.rs:47
↓ 2 callers
Method
max_content_widths
Get the longest content width for all cells of this row
src/row.rs:61
↓ 2 callers
Method
right
Set the right border character.
src/style/table_style.rs:65
↓ 2 callers
Method
set_truncation_indicator
Set the truncation indicator for cells that are too long to be displayed. Defaults to "…". Set it to "..." for example if you want to stick to ASCII.
src/table.rs:317
↓ 2 callers
Function
split_line
Split a line if it's longer than the allowed columns (width - padding). This function tries to do this in a smart way, by splitting the content with
src/utils/formatting/content_split/mod.rs:25
↓ 2 callers
Function
split_long_word
Splits a long word at a given character width. This needs some special logic, as we have to take multi-character UTF-8 symbols into account. When simp
src/utils/formatting/content_split/normal.rs:21
↓ 2 callers
Method
style_text_only
(&mut self)
src/table.rs:402
↓ 2 callers
Function
wide_columns
Determine which columns contain wide (display width 2) characters. Wide characters cannot be broken apart to fit into a column with a content width o
tests/all/property_test.rs:302
↓ 2 callers
Method
width
(&self)
src/table.rs:265
↓ 1 callers
Function
align_line
(table: &Table, info: &ColumnDisplayInfo, cell: &Cell, mut line: String)
src/utils/formatting/content_format.rs:280
↓ 1 callers
Function
arrange
Try to find the best fit for a given content and table_width 1. Determine the amount of available space after applying fixed columns, padding, and bo
src/utils/arrangement/dynamic.rs:127
↓ 1 callers
Method
bottom_border
Set the bottom border of the table.
src/style/table_style.rs:220
↓ 1 callers
Function
build_error
(table: &str, context: &str)
tests/all/property_test.rs:289
↓ 1 callers
Function
build_table
(table: &Table)
src/utils/mod.rs:51
↓ 1 callers
Function
cell_alignment
Each cell can have any alignment.
tests/all/property_test.rs:15
↓ 1 callers
Function
cell_content
Generate random cell content. The `|` char, newlines and control chars are explicitly not included. Those would break the delimiter-based column chec
tests/all/property_test.rs:65
↓ 1 callers
Function
check_if_full
Check if the current line is too long and whether we should start a new one If it's too long, we add the current line to the list of lines and return
src/utils/formatting/content_split/mod.rs:175
↓ 1 callers
Method
column_cells_with_header_iter
Get a mutable iterator over cells of a column, including the header cell. The header cell will be the very first cell returned. The iterator returns a
src/table.rs:583
↓ 1 callers
Function
column_constraint
Any Column can have any constellation of ColumnConstraints
tests/all/property_test.rs:25
↓ 1 callers
Method
content
Return a copy of the content contained in this cell.
src/cell.rs:54
↓ 1 callers
Method
content_arrangement
Get the current content arrangement of the table.
src/table.rs:299
↓ 1 callers
Function
count_remaining_columns
Return the amount of visible columns that haven't been checked yet. - `column_count` is the total amount of columns that are visible, calculated with
src/utils/arrangement/helper.rs:36
↓ 1 callers
Function
count_visible_columns
Return the amount of visible columns
src/utils/arrangement/helper.rs:27
↓ 1 callers
Function
delimiter
Get the delimiter for a Cell. Priority is in decreasing order: Cell -> Column -> Table.
src/utils/arrangement/helper.rs:59
↓ 1 callers
Function
delimiter
(cell: &Cell, info: &ColumnDisplayInfo, table: &Table)
src/utils/formatting/content_format.rs:13
↓ 1 callers
Function
distribute_remaining_space
Step 6 - Second branch Not all columns have a determined width yet -> The content still doesn't fully fit into the given width. This function now eq
src/utils/arrangement/dynamic.rs:536
↓ 1 callers
Function
draw_borders
( table: &Table, rows: &[Vec<Vec<String>>], display_info: &[ColumnDisplayInfo], )
src/utils/formatting/borders.rs:5
↓ 1 callers
Function
draw_bottom_border
(table: &Table, display_info: &[ColumnDisplayInfo])
src/utils/formatting/borders.rs:172
↓ 1 callers
Function
draw_horizontal_lines
The horizontal line that separates between rows.
src/utils/formatting/borders.rs:126
↓ 1 callers
Function
draw_rows
( lines: &mut Vec<String>, rows: &[Vec<Vec<String>>], table: &Table, display_info: &[ColumnDis
src/utils/formatting/borders.rs:67
↓ 1 callers
Function
draw_top_border
(table: &Table, display_info: &[ColumnDisplayInfo])
src/utils/formatting/borders.rs:33
↓ 1 callers
Function
enforce_lower_boundary_constraints
Step 5 Determine, whether there are any columns that are allowed to occupy more width than the current `average_space` via a [LowerBoundary] constrai
src/utils/arrangement/dynamic.rs:327
↓ 1 callers
Function
evaluate
Look at given constraints of a column and check if some of them can be resolved at the very beginning. For example: - We get an absolute width. - Min
src/utils/arrangement/constraint.rs:15
↓ 1 callers
Function
find_columns_that_fit_into_average
Step 2-4 This function is part of the column width calculation process. It checks if there are columns that take less space than there's currently ava
src/utils/arrangement/dynamic.rs:232
↓ 1 callers
Function
format_content
Returns the formatted content of the table. The content is organized in the following structure tc stands for table content and represents the return
src/utils/formatting/content_format.rs:42
↓ 1 callers
Function
format_row
( row: &Row, display_infos: &[ColumnDisplayInfo], table: &Table, )
src/utils/formatting/content_format.rs:57
↓ 1 callers
Function
get_preset_table
()
tests/all/combined_test.rs:4
↓ 1 callers
Method
has_bottom_border
(&self)
src/style/table_style.rs:264
↓ 1 callers
Method
has_header_separator
(&self)
src/style/table_style.rs:268
next →
1–100 of 261, ranked by callers