pub trait HighlighterState {
// Required method
fn highlight_line<'s>(&mut self, line: &'s str) -> Vec<Styled<&'s str>>;
}
Expand description
A stateful highlighter that incrementally highlights lines of a particular source code.
The GraphicalReportHandler
will create a highlighter state by calling
start_highlighter_state
at the
start of rendering, then it will iteratively call
highlight_line
to render individual
highlighted lines. This allows Highlighter
implementations to maintain
mutable parsing and highlighting state.
Required Methods§
Sourcefn highlight_line<'s>(&mut self, line: &'s str) -> Vec<Styled<&'s str>>
fn highlight_line<'s>(&mut self, line: &'s str) -> Vec<Styled<&'s str>>
Highlight an individual line from the source code by returning a vector of [Styled] regions.