#[non_exhaustive]pub enum Language {
Show 15 variants
Rust,
Bash,
CSharp,
Cpp,
Css,
Dockerfile,
Html,
JavaScript,
Json,
Markdown,
Python,
Toml,
Tsx,
TypeScript,
Yaml,
}Expand description
Tree-sitter grammar identifier.
Each variant maps to an Arborium language slug via
Language::slug. Variants are gated by the same lang-* cargo
features as the grammar lookup table, so each build exposes the
variants enabled for that build.
use dioxus_code::Language;
assert_eq!(Language::Rust.slug(), "rust");
assert_eq!(Language::from_slug("brainfuck"), None);Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Rust
Arborium slug "rust".
Bash
Arborium slug "bash".
CSharp
Arborium slug "c-sharp".
Cpp
Arborium slug "cpp".
Css
Arborium slug "css".
Dockerfile
Arborium slug "dockerfile".
Html
Arborium slug "html".
JavaScript
Arborium slug "javascript".
Json
Arborium slug "json".
Markdown
Arborium slug "markdown".
Python
Arborium slug "python".
Toml
Arborium slug "toml".
Tsx
Arborium slug "tsx".
TypeScript
Arborium slug "typescript".
Yaml
Arborium slug "yaml".
Implementations§
Source§impl Language
impl Language
Sourcepub fn detect(input: &str) -> Option<Language>
pub fn detect(input: &str) -> Option<Language>
Best-effort detection from a path, filename, shebang, or file contents.
Wraps arborium::detect_language and maps the resulting slug into a
Language variant, returning None when detection fails or the
detected language’s grammar feature is disabled in this build.
Available with the runtime feature.
Source§impl Language
impl Language
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DependencyElement for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.