6 releases
0.3.1 | Dec 29, 2021 |
---|---|
0.3.0 | Dec 29, 2021 |
0.2.0 | Dec 27, 2021 |
0.1.2 | Dec 26, 2021 |
#5 in #friend
44 downloads per month
17KB
283 lines
text_align
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!"
);
}
lib.rs
:
use text_align::TextAlign;
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!"
);
Dependencies
~2.2–3MB
~54K SLoC