1 unstable release
0.1.0 | May 4, 2022 |
---|
#282 in No standard library
171 downloads per month
Used in 4 crates
7KB
99 lines
Columns
A text manipulation library for displaying separate text in columns
Example
use columns::Columns;
println!(
"{}",
Columns::from(vec![
vec!["line1", "line2", "line3"],
vec!["should", "be", "displayed", "side by side"],
])
.base_tabsize_in(0) // Sets the tabsize to be based in the first one. This is to prevent unnecessary spacing
);
Result:
line1 should
line2 be
line3 displayed
side by side
TODO list
- Post on crates.io
- Customizable separators
lib.rs
:
A text manipulation library for displaying separate text in columns.
Quick Start
The quickest way to get column-separated text is to use the From
implementation for
Columns
.
use columns::Columns;
let column_text = Columns::from(
vec![
vec!["text", "should", "be"],
vec!["in", "different", "columns"],
vec!["even", "in", "more", "than", "two"]
]
);
println!("{}", column_text);
If you're using &format!
s, you may want to use make_columns
method from columns::Columns
.