1 个不稳定版本
0.1.0 | 2019 年 8 月 23 日 |
---|
#435 在 可视化
20KB
303 行
Bauxite
将字符串包裹在盒子中,以更美观的输出到控制台
用法
要使用 Bauxite,请在您的 Cargo.toml
中将其作为依赖项添加。
[dependencies]
bauxite = { git = "https://github.com/Doxterpepper/Bauxite" }
然后在您的源代码中
extern crate bauxite;
fn main() {
let my_message = "Only those who leisurely approach that which the masses are busy about\n\
can be busy about that which the masses take leisurely.\n\
-- Lao Tsu";
println!("{}", bauxite::BoxBuilder::from(my_message);
}
lib.rs
:
使用盒子包裹终端输出
示例
let lorem_ipsum = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis
nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure
dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim
id est laborum.";
let boxed_message = bauxite::BoxBuilder::from(lorem_ipsum).padding(3)
.alignment(bauxite::Alignment::Left);
println!("{}", boxed_message);