pub enum Language {
Json,
Rust,
Python,
Typescript,
Tsx,
}Expand description
Supported languages for syntax highlighting.
Variants§
Json
Rust
Python
Typescript
TypeScript (also used for plain JavaScript).
Tsx
TSX (also used for JSX).
Implementations§
Source§impl Language
impl Language
Sourcepub fn from_str(s: &str) -> Option<Self>
pub fn from_str(s: &str) -> Option<Self>
Parse a language from a code-fence info string.
Accepts common variations like “rust”/“rs”, “python”/“py”, “typescript”/“ts”, “tsx”, “javascript”/“js”, “jsx”.
None for anything else — an info string naming a language with no
grammar here is an ordinary, expected case (a fence tagged text,
or a language nobody has added yet), so this stays an inherent
Option lookup rather than FromStr. Every caller writes
.and_then(Language::from_str) over that Option; the trait would
force a Result and an error type carrying nothing.
Trait Implementations§
impl Copy for Language
impl Eq for Language
impl StructuralPartialEq for Language
Auto Trait Implementations§
impl Freeze for Language
impl RefUnwindSafe for Language
impl Send for Language
impl Sync for Language
impl Unpin for Language
impl UnsafeUnpin for Language
impl UnwindSafe for Language
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