]> git.proxmox.com Git - rustc.git/blob - vendor/annotate-snippets-0.8.0/examples/multislice.rs
New upstream version 1.63.0+dfsg1
[rustc.git] / vendor / annotate-snippets-0.8.0 / examples / multislice.rs
1 use annotate_snippets::{
2 display_list::{DisplayList, FormatOptions},
3 snippet::{Annotation, AnnotationType, Slice, Snippet},
4 };
5
6 fn main() {
7 let snippet = Snippet {
8 title: Some(Annotation {
9 label: Some("mismatched types"),
10 id: None,
11 annotation_type: AnnotationType::Error,
12 }),
13 footer: vec![],
14 slices: vec![
15 Slice {
16 source: "Foo",
17 line_start: 51,
18 origin: Some("src/format.rs"),
19 fold: false,
20 annotations: vec![],
21 },
22 Slice {
23 source: "Faa",
24 line_start: 129,
25 origin: Some("src/display.rs"),
26 fold: false,
27 annotations: vec![],
28 },
29 ],
30 opt: FormatOptions {
31 color: true,
32 ..Default::default()
33 },
34 };
35
36 let dl = DisplayList::from(snippet);
37 println!("{}", dl);
38 }