1 extern crate annotate_snippets
;
3 use annotate_snippets
::display_list
::DisplayList
;
4 use annotate_snippets
::formatter
::DisplayListFormatter
;
5 use annotate_snippets
::snippet
::{Annotation, AnnotationType, Slice, Snippet, SourceAnnotation}
;
8 let snippet
= Snippet
{
9 title
: Some(Annotation
{
10 label
: Some("mismatched types".to_string()),
11 id
: Some("E0308".to_string()),
12 annotation_type
: AnnotationType
::Error
,
14 footer
: vec
![Annotation
{
16 "expected type: `snippet::Annotation`\n found type: `__&__snippet::Annotation`"
20 annotation_type
: AnnotationType
::Note
,
23 source
: " slices: vec![\"A\",".to_string(),
25 origin
: Some("src/multislice.rs".to_string()),
27 annotations
: vec
![SourceAnnotation
{
28 label
: "expected struct `annotate_snippets::snippet::Slice`, found reference"
31 annotation_type
: AnnotationType
::Error
,
36 let dl
= DisplayList
::from(snippet
);
37 let dlf
= DisplayListFormatter
::new(true);
38 println
!("{}", dlf
.format(&dl
));