2 个版本
0.1.1 | 2023年3月23日 |
---|---|
0.1.0 | 2023年3月23日 |
#1937 in 文本处理
19KB
216 行
borderrs
此 crate 允许用户以更美观的方式格式化许多数据结构。
维基百科关于 框绘制字符 的页面非常有帮助
目前,我们支持
slice
,使用BorderFormatter::format_slice
Iterator
,使用BorderFormatter::format_iter
HashMap
,使用BorderFormatter::format_hash_map
- 实现
Display
,使用BorderFormatter::format_display
- 实现
Debug
,使用BorderFormatter::format_debug
使用示例
use borderrs::{styles::THIN, BorderFormatter};
let slice = [0, 1, 2, 3, 4];
println!("{}", THIN.format_slice(&slice));
let mut map = HashMap::default();
map.insert("Jon", 38);
map.insert("Jake", 25);
map.insert("Josh", 17);
println!("{}", THIN.format_hash_map(&map));
println!("{}", THIN.format_display("hello"));
println!("{}", THIN.format_debug("hello"));