Skip to content

Commit

Permalink
Merge pull request #70 from Muscraft/update-readme
Browse files Browse the repository at this point in the history
chore: Update `README.md` example to use `Renderer`
  • Loading branch information
Muscraft authored Dec 12, 2023
2 parents 0b3feac + 7aee278 commit ff0c550
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,7 @@ Usage
-----

```rust
use annotate_snippets::{
display_list::{DisplayList, FormatOptions},
snippet::{Annotation, AnnotationType, Slice, Snippet, SourceAnnotation},
};
use annotate_snippets::{Annotation, AnnotationType, Renderer, Slice, Snippet, SourceAnnotation};

fn main() {
let snippet = Snippet {
Expand All @@ -58,7 +55,7 @@ fn main() {
SourceAnnotation {
label: "",
annotation_type: AnnotationType::Error,
range: (187, 189),
range: (193, 195),
},
SourceAnnotation {
label: "while parsing this struct",
Expand All @@ -67,14 +64,10 @@ fn main() {
},
],
}],
opt: FormatOptions {
color: true,
..Default::default()
},
};

let dl = DisplayList::from(snippet);
println!("{}", dl);
let renderer = Renderer::plain();
println!("{}", renderer.render(snippet));
}
```

Expand Down

0 comments on commit ff0c550

Please sign in to comment.