1 个不稳定版本
0.1.0 | 2020 年 5 月 20 日 |
---|
#20 in #src
17KB
407 行
Splat 0.1
简单的源文件错误处理和突出显示。
使用方法
let mut src = Source::new("my-file.txt", "The quick brown fox...");
src.add_message(0..0, "All of my problems start here.");
src.add_message(4..8, "Turns out this isn't quick.");
src.add_message(16..18, "And it's not a fox!");
// Pretty print the messages:
println!("{}", src);
输出
#1 - All of my problems start here.
my-file.txt:1:1
#2 - Turns out this isn't quick.
my-file.txt:1:5
#3 - And it's not a fox!
my-file.txt:1:17
1 │ The quick brown fox...
│ │ ├───┘ │ │
│ │ │ ├─┘
│ 1 2 3
│