pub struct SyntaxHighlighter { /* private fields */ }Implementations§
Source§impl SyntaxHighlighter
impl SyntaxHighlighter
pub fn new() -> Self
pub fn set_theme(&mut self, theme_name: &str)
pub fn available_themes(&self) -> Vec<String>
pub fn detect_language( &self, text: &str, file_extension: Option<&str>, ) -> Option<String>
Sourcepub fn clear_state_from_line(&mut self, line_number: usize, language: &str)
pub fn clear_state_from_line(&mut self, line_number: usize, language: &str)
Clear cached highlighting state from a specific line onward. This is useful for incremental re-highlighting when text changes.
Sourcepub fn reset_state(&mut self)
pub fn reset_state(&mut self)
Reset all cached highlighting state. Call this when the buffer content has significantly changed.
pub fn highlight_line( &mut self, line: &str, language: &str, line_number: usize, font_family: SharedString, _font_size: f32, ) -> Vec<TextRun>
Sourcepub fn ensure_parse_states(
&mut self,
language: &str,
up_to_line: usize,
lines: &[String],
)
pub fn ensure_parse_states( &mut self, language: &str, up_to_line: usize, lines: &[String], )
Ensure parse states exist up to a given line by parsing from the beginning if needed
pub fn get_theme_background(&self) -> Hsla
pub fn get_theme_foreground(&self) -> Hsla
pub fn get_theme_gutter_background(&self) -> Hsla
pub fn get_theme_line_highlight(&self) -> Hsla
pub fn get_theme_selection(&self) -> Hsla
pub fn load_theme_from_file(&mut self, path: &str) -> Result<(), String>
pub fn load_syntax_from_file(&mut self, path: &str) -> Result<(), String>
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§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 !UnwindSafe for SyntaxHighlighter
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian().