tabular

A MoonBit library for pretty-printing tables in terminal. Ported from Rust tabled.

table
tui
terminal
cli
format
grid
pretty-print
moon add hustcer/tabular@0.5.2
Download zip
Author
Version
0.5.2
License
Apache-2.0
Last updated
4 months ago
Downloads
126
README

#Tabular

A MoonBit library for pretty-printing tables in the terminal. Inspired by the Rust tabled project.

#Features

  • 11 built-in style presets
  • Customizable borders and horizontal lines
  • Alignment, padding, width, height, and formatting controls
  • Row, column, cell, and segment based table editing
  • Column span and row span
  • Panel, merge, highlight, shadow, split, extract, remove, and border correction
  • Builder helpers with index and transpose support

#Installation

moon add hustcer/tabular

#Quick Start

let table = @tabular.Table::from_rows([
["Name", "Language", "Stars"],
["Deno", "Rust/TS", "101k"],
["Bun", "Zig/C++", "76k"],
["Node.js", "C++/JS", "110k"],
])

table.apply(@tabular.Style::modern()) |> ignore
println(table.to_string())

Output:

┌─────────┬──────────┬───────┐ │ Name │ Language │ Stars │ ├─────────┼──────────┼───────┤ │ Deno │ Rust/TS │ 101k │ ├─────────┼──────────┼───────┤ │ Bun │ Zig/C++ │ 76k │ ├─────────┼──────────┼───────┤ │ Node.js │ C++/JS │ 110k │ └─────────┴──────────┴───────┘

#Style Presets

table.apply(@tabular.Style::ascii()) |> ignore
table.apply(@tabular.Style::modern()) |> ignore
table.apply(@tabular.Style::rounded()) |> ignore
table.apply(@tabular.Style::extended()) |> ignore
table.apply(@tabular.Style::dots()) |> ignore
table.apply(@tabular.Style::empty()) |> ignore
table.apply(@tabular.Style::blank()) |> ignore
table.apply(@tabular.Style::re_structured_text()) |> ignore
table.apply(@tabular.Style::ascii_rounded()) |> ignore
table.apply(@tabular.Style::markdown()) |> ignore
table.apply(@tabular.Style::psql()) |> ignore

ascii

+----------+------+ | language | year | +----------+------+ | Rust | 2010 | +----------+------+ | MoonBit | 2022 | +----------+------+

modern

┌──────────┬──────┐ │ language │ year │ ├──────────┼──────┤ │ Rust │ 2010 │ ├──────────┼──────┤ │ MoonBit │ 2022 │ └──────────┴──────┘

rounded

╭──────────┬──────╮ │ language │ year │ ├──────────┼──────┤ │ Rust │ 2010 │ ├──────────┼──────┤ │ MoonBit │ 2022 │ ╰──────────┴──────╯

markdown

| language | year | |----------|------| | Rust | 2010 | | MoonBit | 2022 |

psql

language | year ----------+------ Rust | 2010 MoonBit | 2022

dots

:.................: : language : year : :..........:......: : Rust : 2010 : :..........:......: : MoonBit : 2022 : :.................:

extended

╔══════════╦══════╗ ║ language ║ year ║ ╠══════════╬══════╣ ║ Rust ║ 2010 ║ ╠══════════╬══════╣ ║ MoonBit ║ 2022 ║ ╚══════════╩══════╝

empty / blank

language year Rust 2010 MoonBit 2022

re_structured_text

========== ====== language year ========== ====== Rust 2010 MoonBit 2022 ========== ======

ascii_rounded

.-----------------. | language | year | | Rust | 2010 | | MoonBit | 2022 | '-----------------'

#Custom Style

let style = @tabular.Style::ascii()
.top('─')
.bottom('─')
.left('│')
.right('│')
.horizontal('─')
.vertical('│')
.corner_top_left('┌')
.corner_top_right('┐')
.corner_bottom_left('└')
.corner_bottom_right('┘')

table.apply(style) |> ignore

let style = @tabular.Style::ascii()
.remove_horizontal()
.horizontals([
(1, @tabular.HorizontalLine::full('-', '+', '+', '+')),
])

table.apply(style) |> ignore

#Builder

let builder = @tabular.Builder::default()
builder.push_record(["Name", "Age", "City"])
builder.push_record(["Alice", "30", "NYC"])
builder.push_record(["Bob", "25", "LA"])

let table = builder.build()
println(table.to_string())

///|
let builder = @tabular.Builder::from_rows([
["Name", "Age"],
["Alice", "30"],
["Bob", "25"],
])

///|
let table1 = builder.index().build()

///|
let table2 = builder.index().transpose().build()

///|
let table3 = builder.index().hide().build()

#Common Edits

table.set_align(@tabular.Align::right()) |> ignore
table.set_padding(@tabular.Padding::new(1, 1, 0, 0)) |> ignore
table.set_width(@tabular.Width::wrap(10)) |> ignore
table.set_height(@tabular.Height::increase(2)) |> ignore

table.modify_rows(
@tabular.Rows::first(),
@tabular.Setting::align(@tabular.Align::center()),
) |> ignore

table.modify_cols(
@tabular.Cols::one(1),
@tabular.Setting::width(@tabular.Width::wrap(8)),
) |> ignore

table.modify_cell(
@tabular.Cell::new(1, 2),
@tabular.Setting::format(@tabular.Format::surround("[", "]")),
) |> ignore

#Spans

let table = @tabular.Table::from_rows([
["Team", "Q1", "Q2", "Q3"],
["A", "12", "18", "22"],
["B", "10", "16", "21"],
])

table.apply(@tabular.Style::modern()) |> ignore
table.modify_cell(@tabular.Cell::new(0, 0), @tabular.Span::col(2)) |> ignore
table.correct_borders() |> ignore
println(table.to_string())

Possible output:

┌─────────────┬────┬────┐ │ Team │ Q2 │ Q3 │ ├──────┬──────┼────┼────┤ │ A │ 12 │ 18 │ 22 │ ├──────┼──────┼────┼────┤ │ B │ 10 │ 16 │ 21 │ └──────┴──────┴────┴────┘

#Panels And Merge

let table = @tabular.Table::from_rows([
["0", "1", "2"],
["0", "1", "1"],
["1", "1", "2"],
["1", "1", "1"],
])

table.panel(@tabular.Panel::header("Runtime Comparison")) |> ignore
table.merge(@tabular.Merge::horizontal()) |> ignore
println(table.to_string())

#Highlight And Shadow

table.highlight(
@tabular.Highlight::outline_cell(@tabular.Cell::new(1, 1), '*'),
) |> ignore

table.shadow(@tabular.Shadow::new(1)) |> ignore

#Split, Extract, Remove

table.extract_rows(@tabular.Rows::new(0, 2)) |> ignore
table.remove_cols(@tabular.Cols::one(0)) |> ignore
table.split(@tabular.Split::col(2).concat()) |> ignore

#Validation

The current repository test suite passes:

moon test

#License

Apache-2.0

#
Align

pub enum Align {
Left
Right
Center
}

#
Align::center

fn Align::center() -> Align

#
Align::left

fn Align::left() -> Align

#
Align::right

fn Align::right() -> Align

#
Builder

pub struct Builder {
rows : Array[Array[String]]
empty_cell : String
}

#
Builder::build

fn Builder::build(self : Builder) -> Table

#
Builder::clean

fn Builder::clean(self : Builder) -> Unit

#
Builder::clear

fn Builder::clear(self : Builder) -> Unit

#
Builder::count_cols

fn Builder::count_cols(self : Builder) -> Int

#
Builder::count_records

fn Builder::count_records(self : Builder) -> Int

#
Builder::default

fn Builder::default() -> Builder

#
Builder::extend

fn Builder::extend(self : Builder, row : Array[String]) -> Unit

#
Builder::from_rows

fn Builder::from_rows(rows : Array[Array[String]]) -> Builder

#
Builder::index

fn Builder::index(self : Builder) -> IndexBuilder

Create an IndexBuilder from this Builder for index/transpose operations.

#
Builder::insert_col

fn Builder::insert_col(self : Builder, index : Int, col : Array[String]) -> Unit

#
Builder::insert_record

fn Builder::insert_record(self : Builder, index : Int, row : Array[String]) -> Unit

#
Builder::push_col

fn Builder::push_col(self : Builder, col : Array[String]) -> Unit

#
Builder::push_record

fn Builder::push_record(self : Builder, row : Array[String]) -> Unit

#
Builder::remove_col

fn Builder::remove_col(self : Builder, index : Int) -> Unit

#
Builder::remove_record

fn Builder::remove_record(self : Builder, index : Int) -> Unit

#
Builder::set_empty

fn Builder::set_empty(self : Builder, value : String) -> Unit

#
ByColName

pub struct ByColName {
name : String
}

#
ByColName::new

fn ByColName::new(name : String) -> ByColName

#
Cell

pub struct Cell {
row : Int
col : Int
}

#
Cell::and_

fn Cell::and_(self : Cell, other : Cell) -> Segment

#
Cell::as_segment

fn Cell::as_segment(self : Cell) -> Segment

#
Cell::inverse

fn Cell::inverse(self : Cell) -> Segment

#
Cell::new

fn Cell::new(row : Int, col : Int) -> Cell

#
Cell::not

fn Cell::not(self : Cell, other : Cell) -> Segment

#
Cols

pub struct Cols {
start : Int
end_ : Int
skip_n : Int
step_n : Int
exclude : Cols?
predicate : (Entity) -> Bool?
}

#
Cols::all

fn Cols::all() -> Cols

#
Cols::and_

fn Cols::and_(self : Cols, other : Cols) -> Segment

#
Cols::and_cell

fn Cols::and_cell(self : Cols, cell : Cell) -> Segment

#
Cols::and_rows

fn Cols::and_rows(self : Cols, rows : Rows) -> Segment

#
Cols::as_segment

fn Cols::as_segment(self : Cols) -> Segment

#
Cols::filter

fn Cols::filter(self : Cols, predicate : (Entity) -> Bool) -> Cols

#
Cols::first

fn Cols::first() -> Cols

#
Cols::first_offset

fn Cols::first_offset(offset : Int) -> Cols

#
Cols::intersect

fn Cols::intersect(self : Cols, rows : Rows) -> Segment

#
Cols::inverse

fn Cols::inverse(self : Cols) -> Segment

#
Cols::last

fn Cols::last() -> Cols

#
Cols::last_offset

fn Cols::last_offset(offset : Int) -> Cols

#
Cols::new

fn Cols::new(start : Int, end_ : Int) -> Cols

#
Cols::not

fn Cols::not(self : Cols, other : Cols) -> Cols

#
Cols::not_cell

fn Cols::not_cell(self : Cols, cell : Cell) -> Segment

#
Cols::not_rows

fn Cols::not_rows(self : Cols, rows : Rows) -> Segment

#
Cols::one

fn Cols::one(index : Int) -> Cols

#
Cols::skip

fn Cols::skip(self : Cols, count : Int) -> Cols

#
Cols::step_by

fn Cols::step_by(self : Cols, step : Int) -> Cols

#
Entity

pub enum Entity {
Row(Int)
Col(Int)
}

#
Format

pub enum Format {
Surround(String, String, Bool)
Value(String, Bool)
Content((String) -> String, Bool)
Positioned((String, Int, Int) -> String, Bool)
}

#
Format::content

fn Format::content(transform : (String) -> String) -> Format

#
Format::multiline

fn Format::multiline(self : Format) -> Format

#
Format::positioned

fn Format::positioned(transform : (String, Int, Int) -> String) -> Format

#
Format::surround

fn Format::surround(prefix : String, suffix : String) -> Format

#
Format::value

fn Format::value(text : String) -> Format

#
Height

pub enum Height {
Increase(Int)
Limit(Int)
}

#
Height::increase

fn Height::increase(size : Int) -> Height

#
Height::limit

fn Height::limit(size : Int) -> Height

#
Highlight

pub struct Highlight {
target : HighlightTarget
border :
CellBorder

}

#
Highlight::new_cell

fn Highlight::new_cell(cell : Cell) -> Highlight

#
Highlight::new_cols

fn Highlight::new_cols(cols : Cols) -> Highlight

#
Highlight::new_rows

fn Highlight::new_rows(rows : Rows) -> Highlight

#
Highlight::new_segment

fn Highlight::new_segment(segment : Segment) -> Highlight

#
Highlight::outline_cell

fn Highlight::outline_cell(cell : Cell, ch : Char) -> Highlight

#
Highlight::outline_cols

fn Highlight::outline_cols(cols : Cols, ch : Char) -> Highlight

#
Highlight::outline_rows

fn Highlight::outline_rows(rows : Rows, ch : Char) -> Highlight

#
Highlight::outline_segment

fn Highlight::outline_segment(segment : Segment, ch : Char) -> Highlight

#
Highlight::with_border

#
HighlightTarget

pub enum HighlightTarget {
HCell(Cell)
HRows(Rows)
HCols(Cols)
HSegment(Segment)
}

#
HorizontalLine

#
HorizontalLine::filled

fn HorizontalLine::filled(ch : Char) -> HorizontalLine

#
HorizontalLine::from_style

fn HorizontalLine::from_style(style : Style) -> HorizontalLine

#
HorizontalLine::full

fn HorizontalLine::full(main : Char, left? : Char, intersection? : Char, right? : Char) -> HorizontalLine

#
HorizontalLine::intersection

fn HorizontalLine::intersection(self : HorizontalLine, ch : Char) -> HorizontalLine

#
HorizontalLine::left

fn HorizontalLine::left(self : HorizontalLine, ch : Char) -> HorizontalLine

#
HorizontalLine::new

fn HorizontalLine::new(ch : Char) -> HorizontalLine

#
HorizontalLine::right

fn HorizontalLine::right(self : HorizontalLine, ch : Char) -> HorizontalLine

#
IndexBuilder

pub struct IndexBuilder {
rows : Array[Array[String]]
empty_cell : String
index_col : Int?
index_name : String?
show_index : Bool
}

#
IndexBuilder::build

fn IndexBuilder::build(self : IndexBuilder) -> Table

Build the final Table from the IndexBuilder.

#
IndexBuilder::col

fn IndexBuilder::col(self : IndexBuilder, col : Int) -> IndexBuilder

Use the specified col as the index col (0-based).

#
IndexBuilder::hide

Hide the index col.

#
IndexBuilder::name

fn IndexBuilder::name(self : IndexBuilder, name : String?) -> IndexBuilder

Set the name for the index col. None removes the name row.

#
IndexBuilder::transpose

fn IndexBuilder::transpose(self : IndexBuilder) -> IndexBuilder

Transpose the table (swap rows and cols).

#
Merge

pub enum Merge {
Horizontal
Vertical
}

#
Merge::horizontal

fn Merge::horizontal() -> Merge

#
Merge::vertical

fn Merge::vertical() -> Merge

#
Padding

pub struct Padding {
left : Int
right : Int
top : Int
bottom : Int
}

#
Padding::new

fn Padding::new(left : Int, right : Int, top : Int, bottom : Int) -> Padding

#
Panel

pub enum Panel {
}

#
Panel::footer

fn Panel::footer(text : String) -> PanelConfig

Insert a footer panel after the last row.

#
Panel::header

fn Panel::header(text : String) -> PanelConfig

Insert a header panel at row 0.

#
Panel::horizontal

fn Panel::horizontal(row : Int, text : String) -> PanelConfig

Insert a horizontal panel at the given row index. The panel text spans all cols.

#
Panel::vertical

fn Panel::vertical(col : Int, text : String) -> PanelConfig

Insert a vertical panel at the given col index. The panel text spans all rows.

#
Panel::vertical_with_width

fn Panel::vertical_with_width(col : Int, text : String, width : Int) -> PanelConfig

Insert a vertical panel with text split to fit a certain width.

#
PanelConfig

type PanelConfig

#
Rows

pub struct Rows {
start : Int
end_ : Int
skip_n : Int
step_n : Int
exclude : Rows?
predicate : (Entity) -> Bool?
}

#
Rows::all

fn Rows::all() -> Rows

#
Rows::and_

fn Rows::and_(self : Rows, other : Rows) -> Segment

#
Rows::and_cell

fn Rows::and_cell(self : Rows, cell : Cell) -> Segment

#
Rows::and_cols

fn Rows::and_cols(self : Rows, cols : Cols) -> Segment

#
Rows::as_segment

fn Rows::as_segment(self : Rows) -> Segment

#
Rows::filter

fn Rows::filter(self : Rows, predicate : (Entity) -> Bool) -> Rows

#
Rows::first

fn Rows::first() -> Rows

#
Rows::first_offset

fn Rows::first_offset(offset : Int) -> Rows

#
Rows::intersect

fn Rows::intersect(self : Rows, cols : Cols) -> Segment

#
Rows::inverse

fn Rows::inverse(self : Rows) -> Segment

#
Rows::last

fn Rows::last() -> Rows

#
Rows::last_offset

fn Rows::last_offset(offset : Int) -> Rows

#
Rows::new

fn Rows::new(start : Int, end_ : Int) -> Rows

#
Rows::not

fn Rows::not(self : Rows, other : Rows) -> Rows

#
Rows::not_cell

fn Rows::not_cell(self : Rows, cell : Cell) -> Segment

#
Rows::not_cols

fn Rows::not_cols(self : Rows, cols : Cols) -> Segment

#
Rows::one

fn Rows::one(index : Int) -> Rows

#
Rows::skip

fn Rows::skip(self : Rows, count : Int) -> Rows

#
Rows::step_by

fn Rows::step_by(self : Rows, step : Int) -> Rows

#
Segment

pub struct Segment {
kind : SegmentKind
skip_n : Int
step_n : Int
}

#
Segment::all

fn Segment::all() -> Segment

#
Segment::and_

fn Segment::and_(self : Segment, other : Segment) -> Segment

#
Segment::and_cell

fn Segment::and_cell(self : Segment, cell : Cell) -> Segment

#
Segment::and_cols

fn Segment::and_cols(self : Segment, cols : Cols) -> Segment

#
Segment::and_rows

fn Segment::and_rows(self : Segment, rows : Rows) -> Segment

#
Segment::new

fn Segment::new(row_start : Int, row_end : Int, col_start : Int, col_end : Int) -> Segment

#
Segment::not

fn Segment::not(self : Segment, other : Segment) -> Segment

#
Segment::not_

fn Segment::not_(self : Segment, other : Segment) -> Segment

#
Segment::not_cell

fn Segment::not_cell(self : Segment, cell : Cell) -> Segment

#
Segment::skip

fn Segment::skip(self : Segment, count : Int) -> Segment

#
Segment::step_by

fn Segment::step_by(self : Segment, step : Int) -> Segment

#
SegmentKind

pub enum SegmentKind {
All
Range(Int, Int, Int, Int)
RowsOnly(Rows)
ColsOnly(Cols)
CellOnly(Cell)
Cross(Rows, Cols)
InverseRows(Rows)
InverseCols(Cols)
InverseCell(Cell)
Union2(Segment, Segment)
Diff2(Segment, Segment)
}

#
Setting

pub enum Setting {
Align(Align)
VAlign(VAlign)
Pad(Padding)
W(Width)
H(Height)
Fmt(Format)
SpanCol(Int)
SpanRow(Int)
}

#
Setting::align

fn Setting::align(align : Align) -> Setting

#
Setting::format

fn Setting::format(format : Format) -> Setting

#
Setting::height

fn Setting::height(height : Height) -> Setting

#
Setting::padding

fn Setting::padding(padding : Padding) -> Setting

#
Setting::valign

fn Setting::valign(align : VAlign) -> Setting

#
Setting::width

fn Setting::width(width : Width) -> Setting

#
Shadow

pub struct Shadow {
size : Int
offset : Int
fill : Char
top : Bool
bottom : Bool
left : Bool
right : Bool
}

#
Shadow::new

fn Shadow::new(size : Int) -> Shadow

Create a shadow with default direction (bottom-right) and default fill '▒'.

#
Shadow::set_bottom

fn Shadow::set_bottom(self : Shadow) -> Shadow

#
Shadow::set_fill

fn Shadow::set_fill(self : Shadow, c : Char) -> Shadow

#
Shadow::set_left

fn Shadow::set_left(self : Shadow) -> Shadow

#
Shadow::set_offset

fn Shadow::set_offset(self : Shadow, offset : Int) -> Shadow

#
Shadow::set_right

fn Shadow::set_right(self : Shadow) -> Shadow

#
Shadow::set_top

fn Shadow::set_top(self : Shadow) -> Shadow

#
Span

pub enum Span {
}

#
Span::col

fn Span::col(size : Int) -> Setting

#
Span::row

fn Span::row(size : Int) -> Setting

#
Split

pub struct Split {
// private fields
}

#
Split::clean

fn Split::clean(self : Split) -> Split

#
Split::col

fn Split::col(index : Int) -> Split

#
Split::concat

fn Split::concat(self : Split) -> Split

#
Split::retain

fn Split::retain(self : Split) -> Split

#
Split::row

fn Split::row(index : Int) -> Split

#
Split::zip

fn Split::zip(self : Split) -> Split

#
Style

#
Style::ascii

fn Style::ascii() -> Style

#
Style::ascii_rounded

fn Style::ascii_rounded() -> Style

#
Style::blank

fn Style::blank() -> Style

#
Style::borders

#
Style::bottom

fn Style::bottom(self : Style, ch : Char) -> Style

#
Style::corner_bottom_left

fn Style::corner_bottom_left(self : Style, ch : Char) -> Style

#
Style::corner_bottom_right

fn Style::corner_bottom_right(self : Style, ch : Char) -> Style

#
Style::corner_top_left

fn Style::corner_top_left(self : Style, ch : Char) -> Style

#
Style::corner_top_right

fn Style::corner_top_right(self : Style, ch : Char) -> Style

#
Style::custom_horizontal_lines

fn Style::custom_horizontal_lines(self : Style) -> Array[(Int,
HorizontalLine
)]

#
Style::dots

fn Style::dots() -> Style

#
Style::empty

fn Style::empty() -> Style

#
Style::extended

fn Style::extended() -> Style

#
Style::horizontal

fn Style::horizontal(self : Style, ch : Char) -> Style

#
Style::horizontal_lines

#
Style::horizontals

fn Style::horizontals(self : Style, lines : Array[(Int, HorizontalLine)]) -> Style

#
Style::intersection

fn Style::intersection(self : Style, ch : Char) -> Style

#
Style::intersection_bottom

fn Style::intersection_bottom(self : Style, ch : Char) -> Style

#
Style::intersection_left

fn Style::intersection_left(self : Style, ch : Char) -> Style

#
Style::intersection_right

fn Style::intersection_right(self : Style, ch : Char) -> Style

#
Style::intersection_top

fn Style::intersection_top(self : Style, ch : Char) -> Style

#
Style::left

fn Style::left(self : Style, ch : Char) -> Style

#
Style::markdown

fn Style::markdown() -> Style

#
Style::modern

fn Style::modern() -> Style

#
Style::psql

fn Style::psql() -> Style

#
Style::re_structured_text

fn Style::re_structured_text() -> Style

#
Style::remove_bottom

fn Style::remove_bottom(self : Style) -> Style

#
Style::remove_horizontal

fn Style::remove_horizontal(self : Style) -> Style

#
Style::remove_horizontals

fn Style::remove_horizontals(self : Style) -> Style

#
Style::remove_left

fn Style::remove_left(self : Style) -> Style

#
Style::remove_right

fn Style::remove_right(self : Style) -> Style

#
Style::remove_top

fn Style::remove_top(self : Style) -> Style

#
Style::remove_vertical

fn Style::remove_vertical(self : Style) -> Style

#
Style::right

fn Style::right(self : Style, ch : Char) -> Style

#
Style::rounded

fn Style::rounded() -> Style

#
Style::top

fn Style::top(self : Style, ch : Char) -> Style

#
Style::vertical

fn Style::vertical(self : Style, ch : Char) -> Style

#
Table

pub struct Table {
rows : Array[Array[String]]
config :
SpannedConfig

}

#
Table::apply

fn Table::apply(self : Table, style : Style) -> Table

#
Table::correct_borders

fn Table::correct_borders(self : Table) -> Table

Correct border junctions at span boundaries so merged cells display proper corners.

#
Table::extract_cols

fn Table::extract_cols(self : Table, cols : Cols) -> Table

#
Table::extract_rows

fn Table::extract_rows(self : Table, rows : Rows) -> Table

#
Table::extract_segment

fn Table::extract_segment(self : Table, rows : Rows, cols : Cols) -> Table

#
Table::from_rows

fn Table::from_rows(rows : Array[Array[String]]) -> Table

#
Table::highlight

fn Table::highlight(self : Table, highlight : Highlight) -> Table

#
Table::merge

fn Table::merge(self : Table, merge : Merge) -> Table

Apply merge to the table, combining adjacent duplicate cells using spans.

#
Table::modify_by_col_name

fn Table::modify_by_col_name(self : Table, by_name : ByColName, setting : Setting) -> Table

#
Table::modify_cell

fn Table::modify_cell(self : Table, cell : Cell, setting : Setting) -> Table

#
Table::modify_cols

fn Table::modify_cols(self : Table, cols : Cols, setting : Setting) -> Table

#
Table::modify_rows

fn Table::modify_rows(self : Table, rows : Rows, setting : Setting) -> Table

#
Table::modify_segment

fn Table::modify_segment(self : Table, segment : Segment, setting : Setting) -> Table

#
Table::panel

fn Table::panel(self : Table, panel : PanelConfig) -> Table

Apply a horizontal or vertical panel to the table.

#
Table::remove_by_col_name

fn Table::remove_by_col_name(self : Table, by_name : ByColName) -> Table

#
Table::remove_cols

fn Table::remove_cols(self : Table, cols : Cols) -> Table

#
Table::remove_rows

fn Table::remove_rows(self : Table, rows : Rows) -> Table

#
Table::set_align

fn Table::set_align(self : Table, align : Align) -> Table

#
Table::set_height

fn Table::set_height(self : Table, height : Height) -> Table

#
Table::set_padding

fn Table::set_padding(self : Table, padding : Padding) -> Table

#
Table::set_valign

fn Table::set_valign(self : Table, align : VAlign) -> Table

#
Table::set_width

fn Table::set_width(self : Table, width : Width) -> Table

#
Table::shadow

fn Table::shadow(self : Table, shadow : Shadow) -> Table

#
Table::split

fn Table::split(self : Table, split : Split) -> Table

Apply a Split setting to reshape the table. This resets config (spans, borders) since Split fundamentally changes the table shape.

#
Table::to_string

fn Table::to_string(self : Table) -> String

#
VAlign

pub enum VAlign {
Top
Bottom
Center
}

#
VAlign::bottom

fn VAlign::bottom() -> VAlign

#
VAlign::center

fn VAlign::center() -> VAlign

#
VAlign::top

fn VAlign::top() -> VAlign

#
Width

pub enum Width {
Wrap(Int, String)
Truncate(Int, String)
}

#
Width::truncate

fn Width::truncate(width : Int, suffix? : String) -> Width

#
Width::wrap

fn Width::wrap(width : Int) -> Width

#
Width::wrap_with

fn Width::wrap_with(width : Int, placeholder : String) -> Width