Struct syntect::highlighting::Highlighter [] [src]

pub struct Highlighter<'a> { /* fields omitted */ }

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.

Methods

impl<'a> Highlighter<'a>
[src]

The default style in the absence of any matched rules. Basically what plain text gets highlighted as.

Figures out which scope selector in the theme best matches this scope stack. It only returns any changes to the style that should be applied when the top element is pushed on to the stack. These actually aren't guaranteed to be different than the current style. Basically what this means is that you have to gradually apply styles starting with the default and working your way up the stack in order to get the correct style.

Don't worry if this sounds complex, you shouldn't need to use this method. It's only public because I default to making things public for power users unless I have a good argument nobody will ever need to use the method.

Like get_style but only guarantees returning any new style if the last element of path was just pushed on to the stack. Panics if path is empty.

Returns the fully resolved style for the given stack.

This operation is convenient but expensive. For reasonable performance, the caller should be caching results.

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.

Trait Implementations

impl<'a> Debug for Highlighter<'a>
[src]

Formats the value using the given formatter.