Struct annotate_snippets::formatter::DisplayListFormatter
source · pub struct DisplayListFormatter { /* private fields */ }
Expand description
DisplayListFormatter’ constructor accepts a single argument which
allows the formatter to optionally apply colors and emphasis
using ansi_term
crate.
Example:
use annotate_snippets::formatter::DisplayListFormatter;
use annotate_snippets::display_list::{DisplayList, DisplayLine, DisplaySourceLine};
let dlf = DisplayListFormatter::new(false); // Don't use colors
let dl = DisplayList {
body: vec![
DisplayLine::Source {
lineno: Some(192),
inline_marks: vec![],
line: DisplaySourceLine::Content {
text: "Example line of text".into(),
range: (0, 21)
}
}
]
};
assert_eq!(dlf.format(&dl), "192 | Example line of text");