1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
//! A terminal table renderer with column sizing, truncation, wrapping, and
//! section separators.
//!
//! The crate is designed around three core building blocks:
//!
//! - [`Table`] holds headers, rows, and the rendering configuration.
//! - [`Column`] defines a header plus default styling for a column.
//! - [`Cell`] lets you override styling or truncation on individual values.
//!
//! # Quick Start
//!
//! ```rust
//! use tiny_table::{Cell, Column, Align, Table, Trunc};
//!
//! let mut table = Table::with_columns(vec![
//! Column::new("Name").width(0.30),
//! Column::new("Role").truncate(Trunc::Middle),
//! Column::new("Status"),
//! ]);
//!
//! table.add_section("Team").align(Align::Left);
//! table.add_row(vec![
//! Cell::new("Ada Lovelace"),
//! Cell::new("Principal Engineer"),
//! Cell::new("Active").bright_green().bold(),
//! ]);
//!
//! let rendered = table.render();
//! assert!(rendered.contains("Name"));
//! assert!(rendered.contains("Ada Lovelace"));
//! ```
//!
//! # How It Fits Together
//!
//! - Use [`Table::with_columns`] when you already know the schema.
//! - Use [`Table::add_row`] to append values.
//! - Use [`Table::column`] to tweak one column by index or header text.
//! - Use [`Table::add_section`] or [`Table::add_separator`] to break the table
//! into visual groups.
//! - Use [`Table::render`] when you want the formatted string, or [`Table::print`]
//! when you just want to write it to standard output.
//!
//! When a terminal width is available, fractional columns are distributed across
//! the remaining content width after fixed and content-based columns are resolved.
/// Color types and ANSI escape-code generation used by the styling API.
/// A convenience type for specifying truecolor values by RGB components.
pub use CustomColor;
pub use ;
/// Alignment options for section labels.
pub use Align;
/// A table cell containing content and optional styling overrides.
pub use Cell;
/// A color selector used by styling methods.
pub use Color;
/// A column definition with a header and default styling.
pub use Column;
/// A selector used to style a column by index or header text.
pub use ColumnTarget;
/// A column width configuration used when rendering a table.
pub use ColumnWidth;
/// A section definition used to group rows and render a label.
pub use SectionStyle;
/// The main table type.
pub use Table;
/// A border style used for tables, sections, and separators.
pub use TableStyle;
/// Truncation modes for cell content.
pub use Trunc;