Skip to main content

Language

Enum Language 

Source
#[non_exhaustive]
pub enum Language {
Show 59 variants Asm, Awk, Batch, Bash, C, CSharp, Clojure, CMake, Cobol, CommonLisp, Cpp, Css, Dart, Diff, Dockerfile, Elixir, Erlang, Go, Groovy, Haskell, Hcl, Html, Ini, Java, JavaScript, Jinja2, Json, Julia, Kotlin, Lua, Markdown, Matlab, ObjectiveC, Ocaml, Perl, Php, Postscript, Powershell, Prolog, Python, R, Ruby, Rust, Scala, Scss, Solidity, Sql, Starlark, Swift, TextProto, Toml, TypeScript, Vb, Verilog, Vhdl, Vue, Xml, Yaml, Zig,
}
Expand description

Source language predicted by the embedded Magika student model.

Languages parse from their public slugs with str::parse.

let language = "rust".parse::<betlang::Language>()?;

assert_eq!(language, betlang::Language::Rust);
assert_eq!(language.slug(), "rust");

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Asm

Arborium slug "asm".

§

Awk

Arborium slug "awk".

§

Batch

Arborium slug "batch".

§

Bash

Arborium slug "bash".

§

C

Arborium slug "c".

§

CSharp

Arborium slug "c-sharp".

§

Clojure

Arborium slug "clojure".

§

CMake

Arborium slug "cmake".

§

Cobol

Arborium slug "cobol".

§

CommonLisp

Arborium slug "commonlisp".

§

Cpp

Arborium slug "cpp".

§

Css

Arborium slug "css".

§

Dart

Arborium slug "dart".

§

Diff

Arborium slug "diff".

§

Dockerfile

Arborium slug "dockerfile".

§

Elixir

Arborium slug "elixir".

§

Erlang

Arborium slug "erlang".

§

Go

Arborium slug "go".

§

Groovy

Arborium slug "groovy".

§

Haskell

Arborium slug "haskell".

§

Hcl

Arborium slug "hcl".

§

Html

Arborium slug "html".

§

Ini

Arborium slug "ini".

§

Java

Arborium slug "java".

§

JavaScript

Arborium slug "javascript".

§

Jinja2

Arborium slug "jinja2".

§

Json

Arborium slug "json".

§

Julia

Arborium slug "julia".

§

Kotlin

Arborium slug "kotlin".

§

Lua

Arborium slug "lua".

§

Markdown

Arborium slug "markdown".

§

Matlab

Arborium slug "matlab".

§

ObjectiveC

Arborium slug "objc".

§

Ocaml

Arborium slug "ocaml".

§

Perl

Arborium slug "perl".

§

Php

Arborium slug "php".

§

Postscript

Arborium slug "postscript".

§

Powershell

Arborium slug "powershell".

§

Prolog

Arborium slug "prolog".

§

Python

Arborium slug "python".

§

R

Arborium slug "r".

§

Ruby

Arborium slug "ruby".

§

Rust

Arborium slug "rust".

§

Scala

Arborium slug "scala".

§

Scss

Arborium slug "scss".

§

Solidity

Arborium slug "solidity".

§

Sql

Arborium slug "sql".

§

Starlark

Arborium slug "starlark".

§

Swift

Arborium slug "swift".

§

TextProto

Arborium slug "textproto".

§

Toml

Arborium slug "toml".

§

TypeScript

Arborium slug "typescript".

§

Vb

Arborium slug "vb".

§

Verilog

Arborium slug "verilog".

§

Vhdl

Arborium slug "vhdl".

§

Vue

Arborium slug "vue".

§

Xml

Arborium slug "xml".

§

Yaml

Arborium slug "yaml".

§

Zig

Arborium slug "zig".

Implementations§

Source§

impl Language

Source

pub const fn slug(self) -> &'static str

Arborium/tree-sitter language slug for this detected language.

assert_eq!(betlang::Language::Rust.slug(), "rust");

Trait Implementations§

Source§

impl Clone for Language

Source§

fn clone(&self) -> Language

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Language

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl FromStr for Language

Parses a Language from its public slug.

assert_eq!("rust".parse::<betlang::Language>()?, betlang::Language::Rust);
Source§

type Err = ParseLanguageError

The associated error which can be returned from parsing.
Source§

fn from_str(slug: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
Source§

impl Hash for Language

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Language

Source§

fn eq(&self, other: &Language) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for Language

Source§

impl Eq for Language

Source§

impl StructuralPartialEq for Language

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(_simd: S, value: T) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.