pub enum DisplayMarkType {
AnnotationThrough,
AnnotationStart,
}
Expand description
A type of the DisplayMark
.
Variants§
AnnotationThrough
A mark indicating a multiline annotation going through the current line.
Example:
use annotate_snippets::display_list::*;
use annotate_snippets::formatter::DisplayListFormatter;
let dlf = DisplayListFormatter::new(false); // Don't use colors
let dl = DisplayList {
body: vec![
DisplayLine::Source {
lineno: Some(51),
inline_marks: vec![
DisplayMark {
mark_type: DisplayMarkType::AnnotationThrough,
annotation_type: DisplayAnnotationType::Error,
}
],
line: DisplaySourceLine::Content {
text: "Example".to_string(),
range: (0, 7),
}
}
]
};
assert_eq!(dlf.format(&dl), "51 | | Example");
AnnotationStart
A mark indicating a multiline annotation starting on the given line.
Example:
use annotate_snippets::display_list::*;
use annotate_snippets::formatter::DisplayListFormatter;
let dlf = DisplayListFormatter::new(false); // Don't use colors
let dl = DisplayList {
body: vec![
DisplayLine::Source {
lineno: Some(51),
inline_marks: vec![
DisplayMark {
mark_type: DisplayMarkType::AnnotationStart,
annotation_type: DisplayAnnotationType::Error,
}
],
line: DisplaySourceLine::Content {
text: "Example".to_string(),
range: (0, 7),
}
}
]
};
assert_eq!(dlf.format(&dl), "51 | / Example");
Trait Implementations§
source§impl Clone for DisplayMarkType
impl Clone for DisplayMarkType
source§fn clone(&self) -> DisplayMarkType
fn clone(&self) -> DisplayMarkType
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read more