Struct syntect::highlighting::Highlighter
source · pub struct Highlighter<'a> { /* private fields */ }
Expand description
Basically a wrapper around a Theme
preparing it to be used for highlighting.
This is part of the API to preserve the possibility of caching matches of the selectors of the theme on various scope paths or setting up some kind of accelerator structure.
So for now this does very little but eventually if you keep it around between highlighting runs it will preserve its cache.
Implementations§
source§impl<'a> Highlighter<'a>
impl<'a> Highlighter<'a>
pub fn new(theme: &'a Theme) -> Highlighter<'a>
sourcepub fn get_default(&self) -> Style
pub fn get_default(&self) -> Style
The default style in the absence of any matched rules. Basically what plain text gets highlighted as.
sourcepub fn style_for_stack(&self, stack: &[Scope]) -> Style
pub fn style_for_stack(&self, stack: &[Scope]) -> Style
Returns the fully resolved style for the given stack.
This operation is convenient but expensive. For reasonable performance, the caller should be caching results.
sourcepub fn style_mod_for_stack(&self, path: &[Scope]) -> StyleModifier
pub fn style_mod_for_stack(&self, path: &[Scope]) -> StyleModifier
Returns a StyleModifier
which, if applied to the default style,
would generate the fully resolved style for this stack.
This is made available to applications that are using syntect styles in combination with style information from other sources.
This operation is convenient but expensive. For reasonable performance,
the caller should be caching results. It’s likely slower than style_for_stack
.