Crates.io | align_text |
lib.rs | align_text |
version | 1.0.0 |
source | src |
created_at | 2023-07-18 04:52:37.701346 |
updated_at | 2023-07-18 04:52:37.701346 |
description | Aligns lines in a block of text within a number of columns. |
homepage | |
repository | https://github.com/KhalilOuali/align-rs |
max_upload_size | |
id | 919096 |
size | 11,330 |
This crate defines a trait Align
with a method align_text()
implemented for two types:
Vec<String>
where each String is considered a lineString
You can specify the alignment, the number of columns, whether to wrap long lines, whether to trim lines first, etc.
align_text(Where::Center, Some((30, false)), true, Bias::Right, true)
Input lines:
"Hello ",
" World!",
" This should center-align ",
Output lines:
" Hello ",
" World! ",
" This should center-align ",
align_text(Where::Right, Some((40, false)), false, Bias::Left, false)
Input text's lines:
"graphic design"
"is my"
"pAsSiOn"
" graphic design",
" is my",
" pAsSiOn",