forked from rust-lang/annotate-snippets-rs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfooter.rs
23 lines (21 loc) · 855 Bytes
/
footer.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
use annotate_snippets::{AnnotationKind, Group, Level, Renderer, Snippet};
fn main() {
let message = Level::ERROR
.header("mismatched types")
.id("E0308")
.group(
Group::new().element(
Snippet::source(" slices: vec![\"A\",")
.line_start(13)
.origin("src/multislice.rs")
.annotation(AnnotationKind::Primary.span(21..24).label(
"expected struct `annotate_snippets::snippet::Slice`, found reference",
)),
),
)
.group(Group::new().element(Level::NOTE.title(
"expected type: `snippet::Annotation`\n found type: `__&__snippet::Annotation`",
)));
let renderer = Renderer::styled();
anstream::println!("{}", renderer.render(message));
}