#[non_exhaustive]pub enum Lang {
Show 45 variants
Asm,
Bash,
C,
CSharp,
Cmake,
Cpp,
Css,
Diff,
Ejs,
Elixir,
Erb,
Fish,
Gleam,
Go,
Haskell,
Html,
Java,
Javascript,
Jsdoc,
Json,
Julia,
Kotlin,
Lalrpop,
Lua,
Make,
Markdown,
MarkdownInline,
Nix,
Ocaml,
OcamlInterface,
Php,
PhpOnly,
Printf,
Python,
Ql,
Regex,
Ruby,
Rush,
Rust,
Scala,
Sql,
Tsx,
Typescript,
Yaml,
Zig,
}
Expand description
An enum of every supported language in the current feature set.
An instance of the respective tree-stter
Language
can be obtained with the
get
method.
You can also get a Lang
from its name using
for_name
, or for a
FileType
using
for_file_type
.
See the docs for each variant to see its “name” and the supported file types.
Both of these require the
SupportedLanguage
trait to be
in scope.
See LANGUAGES
for a list containing all variants and LANGUAGE_NAMES
for a list
of all valid names.
The enum is marked as non-exhaustive for two reasons:
- New languages may be added in the future
- The variants are enabled/disabled by features
§Example
use syntastica_parsers_gitdep::{Lang, LANGUAGES, LANGUAGE_NAMES};
use syntastica_core::language_set::{SupportedLanguage, FileType};
// you can get a `Lang` from its name
assert_eq!(Lang::Rust, Lang::for_name("rust", &()).unwrap());
// and for a file type
assert_eq!(Some(Lang::Rust), Lang::for_file_type(FileType::Rust, &()));
// `LANGUAGES` is a list of all variants,
// `LANGUAGE_NAMES` is a list of all variant names
for (&lang, &name) in LANGUAGES.iter().zip(LANGUAGE_NAMES) {
assert_eq!(lang, Lang::for_name(name, &()).unwrap());
// `Lang` instances can be turned into strings
assert_eq!(lang, Lang::for_name(<Lang as SupportedLanguage<'_, ()>>::name(&lang), &()).unwrap());
assert_eq!(lang, Lang::for_name(lang.to_string(), &()).unwrap());
assert_eq!(lang, Lang::for_name(lang.as_ref(), &()).unwrap());
let lang_name: &'static str = lang.into();
assert_eq!(lang, Lang::for_name(lang_name, &()).unwrap());
}
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Asm
most
or asm
only.Bash
some
or bash
only.C
some
or c
only.CSharp
most
or c_sharp
only.Cmake
most
or cmake
only.Cpp
some
or cpp
only.Css
some
or css
only.Diff
most
or diff
only.Ejs
all
or ejs
only.Provides the ejs
language, supports these file types: ejavascript
.
Elixir
most
or elixir
only.Erb
all
or erb
only.Fish
all
or fish
only.Gleam
all
or gleam
only.Go
some
or go
only.Haskell
most
or haskell
only.Html
some
or html
only.Java
some
or java
only.Javascript
some
or javascript
only.Provides the javascript
language, supports these file types: javascript
, jsx
.
Jsdoc
most
or jsdoc
only.Provides the jsdoc
language, supports no file types.
Json
some
or json
only.Julia
all
or julia
only.Kotlin
some
or kotlin
only.Lalrpop
all
or lalrpop
only.Provides the lalrpop
language, supports no file types.
Lua
some
or lua
only.Make
most
or make
only.Markdown
most
or markdown
only.MarkdownInline
most
or markdown_inline
only.Provides the markdown_inline
language, supports no file types.
Nix
most
or nix
only.Ocaml
all
or ocaml
only.OcamlInterface
all
or ocaml_interface
only.Provides the ocaml_interface
language, supports these file types: ocamlinterface
.
Php
most
or php
only.PhpOnly
most
or php_only
only.Provides the php_only
language, supports no file types.
Printf
most
or printf
only.Provides the printf
language, supports no file types.
Python
some
or python
only.Ql
all
or ql
only.Regex
most
or regex
only.Provides the regex
language, supports no file types.
Ruby
most
or ruby
only.Rush
all
or rush
only.Rust
some
or rust
only.Scala
most
or scala
only.Sql
most
or sql
only.Tsx
some
or tsx
only.Typescript
some
or typescript
only.Provides the typescript
language, supports these file types: typescript
.
Yaml
some
or yaml
only.Zig
most
or zig
only.Implementations§
Source§impl Lang
impl Lang
Sourcepub fn get_config(&self) -> Result<HighlightConfiguration>
pub fn get_config(&self) -> Result<HighlightConfiguration>
Create an instance of the corresponding
HighlightConfiguration
.
Sourcepub fn highlights_query(&self) -> &'static str
pub fn highlights_query(&self) -> &'static str
Get the highlights query for this language.
Sourcepub fn injections_query(&self) -> &'static str
pub fn injections_query(&self) -> &'static str
Get the injections query for this language.
Sourcepub fn locals_query(&self) -> &'static str
pub fn locals_query(&self) -> &'static str
Get the locals query for this language.
Trait Implementations§
Source§impl<S> SupportedLanguage<'_, S> for Lang
impl<S> SupportedLanguage<'_, S> for Lang
impl Copy for Lang
impl Eq for Lang
impl StructuralPartialEq for Lang
Auto Trait Implementations§
impl Freeze for Lang
impl RefUnwindSafe for Lang
impl Send for Lang
impl Sync for Lang
impl Unpin for Lang
impl UnwindSafe for Lang
Blanket Implementations§
Source§impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere
T: Real + Zero + Arithmetics + Clone,
Swp: WhitePoint<T>,
Dwp: WhitePoint<T>,
D: AdaptFrom<S, Swp, Dwp, T>,
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere
T: Real + Zero + Arithmetics + Clone,
Swp: WhitePoint<T>,
Dwp: WhitePoint<T>,
D: AdaptFrom<S, Swp, Dwp, T>,
Source§fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<T>,
fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<T>,
Source§fn adapt_into(self) -> D
fn adapt_into(self) -> D
Source§impl<T, C> ArraysFrom<C> for Twhere
C: IntoArrays<T>,
impl<T, C> ArraysFrom<C> for Twhere
C: IntoArrays<T>,
Source§fn arrays_from(colors: C) -> T
fn arrays_from(colors: C) -> T
Source§impl<T, C> ArraysInto<C> for Twhere
C: FromArrays<T>,
impl<T, C> ArraysInto<C> for Twhere
C: FromArrays<T>,
Source§fn arrays_into(self) -> C
fn arrays_into(self) -> C
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<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for Uwhere
T: FromCam16Unclamped<WpParam, U>,
impl<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for Uwhere
T: FromCam16Unclamped<WpParam, U>,
Source§type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar
type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar
parameters
when converting.Source§fn cam16_into_unclamped(
self,
parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>,
) -> T
fn cam16_into_unclamped( self, parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>, ) -> T
self
into C
, using the provided parameters.Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T, C> ComponentsFrom<C> for Twhere
C: IntoComponents<T>,
impl<T, C> ComponentsFrom<C> for Twhere
C: IntoComponents<T>,
Source§fn components_from(colors: C) -> T
fn components_from(colors: C) -> T
Source§impl<T> FromAngle<T> for T
impl<T> FromAngle<T> for T
Source§fn from_angle(angle: T) -> T
fn from_angle(angle: T) -> T
angle
.Source§impl<T, U> FromStimulus<U> for Twhere
U: IntoStimulus<T>,
impl<T, U> FromStimulus<U> for Twhere
U: IntoStimulus<T>,
Source§fn from_stimulus(other: U) -> T
fn from_stimulus(other: U) -> T
other
into Self
, while performing the appropriate scaling,
rounding and clamping.Source§impl<T, U> IntoAngle<U> for Twhere
U: FromAngle<T>,
impl<T, U> IntoAngle<U> for Twhere
U: FromAngle<T>,
Source§fn into_angle(self) -> U
fn into_angle(self) -> U
T
.Source§impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for Uwhere
T: Cam16FromUnclamped<WpParam, U>,
impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for Uwhere
T: Cam16FromUnclamped<WpParam, U>,
Source§type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar
type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar
parameters
when converting.Source§fn into_cam16_unclamped(
self,
parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>,
) -> T
fn into_cam16_unclamped( self, parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>, ) -> T
self
into C
, using the provided parameters.Source§impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
Source§fn into_color(self) -> U
fn into_color(self) -> U
Source§impl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
impl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
Source§fn into_color_unclamped(self) -> U
fn into_color_unclamped(self) -> U
Source§impl<T> IntoStimulus<T> for T
impl<T> IntoStimulus<T> for T
Source§fn into_stimulus(self) -> T
fn into_stimulus(self) -> T
self
into T
, while performing the appropriate scaling,
rounding and clamping.Source§impl<T, C> TryComponentsInto<C> for Twhere
C: TryFromComponents<T>,
impl<T, C> TryComponentsInto<C> for Twhere
C: TryFromComponents<T>,
Source§type Error = <C as TryFromComponents<T>>::Error
type Error = <C as TryFromComponents<T>>::Error
try_into_colors
fails to cast.Source§fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>
fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>
Source§impl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
impl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
Source§fn try_into_color(self) -> Result<U, OutOfBounds<U>>
fn try_into_color(self) -> Result<U, OutOfBounds<U>>
OutOfBounds
error is returned which contains
the unclamped color. Read more