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