Struct tree_sitter_highlight::Highlighter [−][src]
pub struct Highlighter { /* fields omitted */ }
Expand description
Performs syntax highlighting, recognizing a given list of highlight names.
For the best performance Highlighter
values should be reused between
syntax highlighting calls. A separate highlighter is needed for each thread that
is performing highlighting.
Implementations
pub fn highlight<'a>(
&'a mut self,
config: &'a HighlightConfiguration,
source: &'a [u8],
cancellation_flag: Option<&'a AtomicUsize>,
injection_callback: impl FnMut(&str) -> Option<&'a HighlightConfiguration> + 'a
) -> Result<impl Iterator<Item = Result<HighlightEvent, Error>> + 'a, Error>
pub fn highlight<'a>(
&'a mut self,
config: &'a HighlightConfiguration,
source: &'a [u8],
cancellation_flag: Option<&'a AtomicUsize>,
injection_callback: impl FnMut(&str) -> Option<&'a HighlightConfiguration> + 'a
) -> Result<impl Iterator<Item = Result<HighlightEvent, Error>> + 'a, Error>
Iterate over the highlighted regions for a given slice of source code.