tabular: plain text tables in Rust
Builds plain, automatically-aligned tables of monospaced text.
This is basically what you want if you are implementing ls
.
Example
use ;
use Path;
ls.unwrap;
produces something like
1198 target/.rustc_info.json
1120 d target/doc
672 d target/debug
Usage
It's on crates.io, so you can add
[]
= "0.1.1"
to your Cargo.toml
.
Feature unicode-width
is enabled be default; it depends on the
unicode-width crate. You can turn
it off with:
[]
= { = "0.1.1", = false }
Note that without unicode-width
, alignment will be based on the count of the
std::str::Chars
iterator.
This crate supports Rust version 1.18.0 and later.
See also
You may also want:
-
text-tables – This is more automatic than tabular. You give it an array of arrays, it renders a nice table with borders. Tabular doesn't do borders.
-
prettytable — This has an API more similar to tabular’s in terms of building a table, but it does a lot more, including, color, borders, and CSV import.