#source #highlighting #messages #src #problem

splat

Error handling and highlighting for source files

1 unstable release

0.1.0 May 20, 2020

#14 in #src

Custom license

17KB
407 lines

Splat 0.1

Simple error handling and highlighting for source files.

Usage

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);

Output

#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

No runtime deps