summaryrefslogtreecommitdiffstats
path: root/vendor/annotate-snippets-0.8.0/examples/expected_type.rs
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/annotate-snippets-0.8.0/examples/expected_type.rs')
-rw-r--r--vendor/annotate-snippets-0.8.0/examples/expected_type.rs43
1 files changed, 43 insertions, 0 deletions
diff --git a/vendor/annotate-snippets-0.8.0/examples/expected_type.rs b/vendor/annotate-snippets-0.8.0/examples/expected_type.rs
new file mode 100644
index 000000000..89f0ddc11
--- /dev/null
+++ b/vendor/annotate-snippets-0.8.0/examples/expected_type.rs
@@ -0,0 +1,43 @@
+use annotate_snippets::{
+ display_list::{DisplayList, FormatOptions},
+ snippet::{Annotation, AnnotationType, Slice, Snippet, SourceAnnotation},
+};
+
+fn main() {
+ let snippet = Snippet {
+ title: Some(Annotation {
+ label: Some("expected type, found `22`"),
+ id: None,
+ annotation_type: AnnotationType::Error,
+ }),
+ footer: vec![],
+ slices: vec![Slice {
+ source: r#" annotations: vec![SourceAnnotation {
+ label: "expected struct `annotate_snippets::snippet::Slice`, found reference"
+ ,
+ range: <22, 25>,"#,
+ line_start: 26,
+ origin: Some("examples/footer.rs"),
+ fold: true,
+ annotations: vec![
+ SourceAnnotation {
+ label: "",
+ annotation_type: AnnotationType::Error,
+ range: (205, 207),
+ },
+ SourceAnnotation {
+ label: "while parsing this struct",
+ annotation_type: AnnotationType::Info,
+ range: (34, 50),
+ },
+ ],
+ }],
+ opt: FormatOptions {
+ color: true,
+ ..Default::default()
+ },
+ };
+
+ let dl = DisplayList::from(snippet);
+ println!("{}", dl);
+}