Skip to content

Commit 7aee278

Browse files
committed
chore: Update README.md example to use Renderer
1 parent 0b3feac commit 7aee278

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

Diff for: README.md

+4-11
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,7 @@ Usage
3333
-----
3434

3535
```rust
36-
use annotate_snippets::{
37-
display_list::{DisplayList, FormatOptions},
38-
snippet::{Annotation, AnnotationType, Slice, Snippet, SourceAnnotation},
39-
};
36+
use annotate_snippets::{Annotation, AnnotationType, Renderer, Slice, Snippet, SourceAnnotation};
4037

4138
fn main() {
4239
let snippet = Snippet {
@@ -58,7 +55,7 @@ fn main() {
5855
SourceAnnotation {
5956
label: "",
6057
annotation_type: AnnotationType::Error,
61-
range: (187, 189),
58+
range: (193, 195),
6259
},
6360
SourceAnnotation {
6461
label: "while parsing this struct",
@@ -67,14 +64,10 @@ fn main() {
6764
},
6865
],
6966
}],
70-
opt: FormatOptions {
71-
color: true,
72-
..Default::default()
73-
},
7467
};
7568

76-
let dl = DisplayList::from(snippet);
77-
println!("{}", dl);
69+
let renderer = Renderer::plain();
70+
println!("{}", renderer.render(snippet));
7871
}
7972
```
8073

0 commit comments

Comments
 (0)