| Crates.io | tree_fmt |
| lib.rs | tree_fmt |
| version | 0.9.0 |
| created_at | 2025-10-25 10:36:15.361263+00 |
| updated_at | 2026-01-22 18:56:00.432803+00 |
| description | Multi-format data visualization library with 10 formatters, 31 variants, and granular per-variant feature flags for minimal binary size |
| homepage | |
| repository | https://github.com/Wandalen/willbe/tree/master/module/tree_fmt |
| max_upload_size | |
| id | 1900051 |
| size | 751,578 |
Multi-format data visualization library: 10 formatters, 31 variants, zero core dependencies.
Build once, format anywhere: Create your data structure once, then output as ASCII table, JSON, HTML, SQL, YAML, tree view, or 6 other formats - without rebuilding data. Features granular compilation (31 flags) and zero core dependencies.
cargo add tree_fmt # Default: table, tree, expanded, logfmt
cargo add tree_fmt --no-default-features --features table_plain # Minimal
use tree_fmt::{ RowBuilder, TableFormatter, Format };
let view = RowBuilder::new( vec![ "Name".into(), "Age".into() ] )
.add_row( vec![ "Alice".into(), "30".into() ] )
.add_row( vec![ "Bob".into(), "25".into() ] )
.build_view();
let formatter = TableFormatter::new();
let output = formatter.format( &view )?;
println!( "{}", output );
Output:
Name Age
----- ---
Alice 30
Bob 25
| Format | Use Case | Variants | Feature Flags | Example |
|---|---|---|---|---|
| Table | CLI tools, terminals | 9 styles | table_plain, table_markdown, table_csv, table_bordered, table_grid, table_unicode, table_minimal, table_tsv, table_compact |
→ |
| Tree | File trees, hierarchies | 3 styles | tree_hierarchical, tree_aligned, tree_aggregated |
→ |
| Expanded | PostgreSQL \x mode | 2 styles | expanded_postgres, expanded_property |
→ |
| JSON | APIs, config files | Pretty/Compact | format_json |
→ |
| HTML | Web dashboards | 4 themes | html_minimal, html_bootstrap, html_tailwind, html_custom |
→ |
| SQL | Database seeds | 4 dialects | sql_ansi, sql_postgres, sql_mysql, sql_sqlite |
→ |
| YAML | Config export | Standard | format_yaml |
→ |
| TOML | Cargo.toml gen | Standard | format_toml |
→ |
| Logfmt | Structured logs | Standard | format_logfmt |
→ |
| Text | Docs, CLI help | 6 styles | format_text |
→ |
Total: 31 variants across 10 formatters · Detailed variant docs →
Run examples:
cargo run --example table_format --all-features
cargo run --example unified_formats --all-features
# Default (4 formatters)
tree_fmt = "0.4.0"
# Minimal (single formatter)
tree_fmt = { version = "0.4.0", default-features = false, features = [ "table_plain" ] }
# Specific use case
tree_fmt = { version = "0.4.0", features = [ "table_markdown", "format_json" ] }
# Everything
tree_fmt = { version = "0.4.0", features = [ "all_formats" ] }
31 granular flags available - each variant has its own flag for minimal binary size.
Meta-features: format_table (all 9 table variants), format_html (all 4 HTML variants), format_sql (all 4 SQL dialects), visual_formats, data_formats, all_formats
cargo test --all-features # Run tests
cargo doc --open --all-features # View docs locally
MIT - v0.4.0 - Repository