pub struct SyntaxHighlighter { /* private fields */ }Expand description
Tokenizes lines for one language while preserving multi-line parse state.
Implementations§
Source§impl SyntaxHighlighter
impl SyntaxHighlighter
Sourcepub fn new(grammar_set: &GrammarSet, language: &str) -> Option<Self>
pub fn new(grammar_set: &GrammarSet, language: &str) -> Option<Self>
Creates a highlighter for language, or returns None when no loaded grammar matches it.
Sourcepub fn tokenize_line(&mut self, line: &str) -> Vec<TokenSpan>
pub fn tokenize_line(&mut self, line: &str) -> Vec<TokenSpan>
Tokenizes one line, updates continuation state, and falls back to a plain full-line span on parse errors.
Trait Implementations§
Source§impl Clone for SyntaxHighlighter
impl Clone for SyntaxHighlighter
Source§fn clone(&self) -> SyntaxHighlighter
fn clone(&self) -> SyntaxHighlighter
Returns a duplicate 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 moreAuto Trait Implementations§
impl !Freeze for SyntaxHighlighter
impl RefUnwindSafe for SyntaxHighlighter
impl Send for SyntaxHighlighter
impl Sync for SyntaxHighlighter
impl Unpin for SyntaxHighlighter
impl UnsafeUnpin for SyntaxHighlighter
impl UnwindSafe for SyntaxHighlighter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more