pub enum DisplayHeaderType {
Initial,
Continuation,
}
Expand description
Information whether the header is the initial one or a consequitive one for multi-slice cases.
Variants§
Initial
Initial header is the first header in the snippet.
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::Raw(DisplayRawLine::Origin {
path: "file1.rs".to_string(),
pos: Some((51, 5)),
header_type: DisplayHeaderType::Initial,
})
]
};
assert_eq!(dlf.format(&dl), "--> file1.rs:51:5");
Continuation
Continuation marks all headers of following slices in the snippet.
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::Raw(DisplayRawLine::Origin {
path: "file1.rs".to_string(),
pos: Some((51, 5)),
header_type: DisplayHeaderType::Continuation,
})
]
};
assert_eq!(dlf.format(&dl), "::: file1.rs:51:5");
Trait Implementations§
source§impl Clone for DisplayHeaderType
impl Clone for DisplayHeaderType
source§fn clone(&self) -> DisplayHeaderType
fn clone(&self) -> DisplayHeaderType
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