pub struct Highlighter { /* private fields */ }Implementations§
Source§impl Highlighter
impl Highlighter
Sourcepub fn new(syntax: SyntaxTheme) -> Self
pub fn new(syntax: SyntaxTheme) -> Self
Build a highlighter whose foregrounds come from syntax.
Sourcepub fn highlight(&self, path: &str, content: &str) -> Vec<Vec<StyledRange>>
pub fn highlight(&self, path: &str, content: &str) -> Vec<Vec<StyledRange>>
Highlight content as the language guessed from path’s extension.
Returns one Vec<StyledRange> per line (without trailing newlines).
Unknown languages produce empty ranges per line (plain rendering).
Sourcepub fn scope_index(&self, path: &str, content: &str) -> ScopeIndex
pub fn scope_index(&self, path: &str, content: &str) -> ScopeIndex
Definition breadcrumb index for content, computed via the same grammar
registry used for highlighting. Empty for unsupported languages.
Sourcepub fn syntactic_emphasis(&self, file: &mut FileDiff) -> bool
pub fn syntactic_emphasis(&self, file: &mut FileDiff) -> bool
Set AST-diff char-precise emphasis on file. Returns false (caller
should fall back to the textual engine) when unavailable.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Highlighter
impl RefUnwindSafe for Highlighter
impl Send for Highlighter
impl Sync for Highlighter
impl Unpin for Highlighter
impl UnsafeUnpin for Highlighter
impl UnwindSafe for Highlighter
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