Struct cobalt::SyntaxHighlight
source · #[non_exhaustive]pub struct SyntaxHighlight { /* private fields */ }Expand description
Highlight code block
Implementations§
source§impl Syntax
impl Syntax
pub fn new() -> Syntax
Available on crate feature
syntax-highlight only.pub fn load_custom_syntaxes(&mut self, syntaxes_path: &Path)
Available on crate feature
syntax-highlight only.pub fn has_theme(&self, name: &str) -> bool
Available on crate feature
syntax-highlight only.pub fn themes(&self) -> impl Iterator<Item = String>
Available on crate feature
syntax-highlight only.pub fn syntaxes(&self) -> impl Iterator<Item = String>
Available on crate feature
syntax-highlight only.pub fn default_theme(&self) -> Option<&str>
Available on crate feature
syntax-highlight only.pub fn set_default_theme(&mut self, theme: impl Into<String>)
Available on crate feature
syntax-highlight only.pub fn format( &self, code: &str, lang: Option<&str>, theme: Option<&str>, ) -> String
Available on crate feature
syntax-highlight only.Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Syntax
impl RefUnwindSafe for Syntax
impl Send for Syntax
impl Sync for Syntax
impl Unpin for Syntax
impl UnwindSafe for Syntax
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
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 more