-
-
Save legendiguess/ccb197dac4bc77e3ae7571befc8ffbe2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use annotate_snippets::display_list::DisplayList; | |
use annotate_snippets::display_list::FormatOptions; | |
use annotate_snippets::snippet::{Annotation, AnnotationType, Slice, Snippet, SourceAnnotation}; | |
fn main() { | |
let snippet = Snippet { | |
title: Some(Annotation { | |
label: Some("er".to_string()), | |
id: None, | |
annotation_type: AnnotationType::Error, | |
}), | |
footer: vec![], | |
slices: vec![ | |
Slice { | |
source: "fn main(): float { | |
t | |
}" | |
.to_string(), | |
line_start: 51, | |
origin: Some("src/format.rs".to_string()), | |
fold: false, | |
annotations: vec![SourceAnnotation { | |
label: "error here".to_string(), | |
annotation_type: AnnotationType::Error, | |
range: (21, 22), | |
}], | |
}, | |
Slice { | |
source: "fn main(): float { | |
\tt | |
}" | |
.to_string(), | |
line_start: 51, | |
origin: Some("src/format.rs".to_string()), | |
fold: false, | |
annotations: vec![SourceAnnotation { | |
label: "error here".to_string(), | |
annotation_type: AnnotationType::Error, | |
range: (21, 22), | |
}], | |
}, | |
], | |
opt: FormatOptions { | |
color: false, | |
anonymized_line_numbers: false, | |
}, | |
}; | |
let dl = DisplayList::from(snippet); | |
println!("{}", dl.to_string()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment