Crates.io | text_align |
lib.rs | text_align |
version | 0.3.1 |
source | src |
created_at | 2021-12-26 04:39:07.500183 |
updated_at | 2021-12-29 07:42:15.796353 |
description | A crate that provides a single trait for various alignments of text |
homepage | |
repository | https://github.com/JosephTLyons/text_align_rust |
max_upload_size | |
id | 503196 |
size | 50,839 |
A Rust crate that provides a single trait for various alignments of text
use text_align::TextAlign;
fn main() {
assert_eq!(
" Hello my dearest friend!".left_align(50),
"Hello my dearest friend! "
);
assert_eq!(
"Hello my dearest friend!".right_align(50),
" Hello my dearest friend!"
);
assert_eq!(
"Hello my dearest friend!".center_align(50),
" Hello my dearest friend! "
);
assert_eq!(
"Hello my dearest friend!".justify(50),
"Hello my dearest friend!"
);
assert_eq!(
"Hello my dearest friend!".dejustify(2),
"Hello my dearest friend!"
);
}