Skip to main content

LANG

Enum LANG 

Source
pub enum LANG {
Show 21 variants Mozjs, Javascript, Java, Go, Kotlin, Lua, Rust, Tcl, Cpp, Csharp, Elixir, Python, Tsx, Typescript, Bash, Ccomment, Preproc, Perl, Php, Ruby, Groovy,
}
Expand description

The list of supported languages.

Every variant is always defined regardless of the Cargo feature set: per-language features only gate the grammar crate references, never the enum surface itself. Disabled variants surface at runtime as crate::MetricsError::LanguageDisabled from every entry point that returns a Result.

Variants§

§

Mozjs

The Mozjs language is variant of the JavaScript language

§

Javascript

The JavaScript language

§

Java

The Java language

§

Go

The Go language

§

Kotlin

The Kotlin language

§

Lua

The Lua language

§

Rust

The Rust language

§

Tcl

The Tcl language

§

Cpp

The C/C++ language

§

Csharp

The C# language

§

Elixir

The Elixir language

§

Python

The Python language

§

Tsx

The Tsx language incorporates the JSX syntax inside TypeScript

§

Typescript

The TypeScript language

§

Bash

The Bash language

§

Ccomment

The Ccomment language is a variant of the C language focused on comments

§

Preproc

The PreProc language is a variant of the C/C++ language focused on macros

§

Perl

The Perl language

§

Php

The Php language

§

Ruby

The Ruby language

§

Groovy

The Groovy language

Implementations§

Source§

impl LANG

Source

pub fn into_enum_iter() -> impl Iterator<Item = LANG>

Return an iterator over the supported languages.

§Examples
use big_code_analysis::LANG;

for lang in LANG::into_enum_iter() {
    println!("{:?}", lang);
}
Source

pub fn get_name(&self) -> &'static str

Returns the name of a language as a &str.

§Examples
use big_code_analysis::LANG;

println!("{}", LANG::Rust.get_name());
Source

pub fn is_enabled(&self) -> bool

Reports whether this variant’s grammar crate is compiled into the current build.

Returns false for variants whose per-language Cargo feature is disabled; calling Self::get_tree_sitter_language, crate::analyze, or any other dispatcher with such a variant will return crate::MetricsError::LanguageDisabled.

Source

pub fn get_tree_sitter_language(&self) -> Result<Language, MetricsError>

Returns the tree_sitter::Language grammar used by this variant.

Useful when feeding a caller-built tree_sitter::Parser into the crate::metrics_from_tree / [crate::Parser::from_tree] entry points — the language returned here is the one the metric walker expects for kind_id matching, so the trees agree structurally.

This method is part of the value-not-stable surface: the underlying tree-sitter-* grammar pin may bump in any minor release, which can change Language equality on the caller side.

§Errors

Returns crate::MetricsError::LanguageDisabled when the variant’s per-language Cargo feature is not enabled in the current build (see the [features] table in the root Cargo.toml).

§Examples
use big_code_analysis::LANG;

let _lang = LANG::Rust.get_tree_sitter_language().expect("rust feature enabled");
Source§

impl LANG

Source

pub fn get_extensions(&self) -> &'static [&'static str]

Returns the file extensions recognised for this language.

The returned list is the same one consulted by get_from_ext and crate::get_language_for_file. Helper variants without user-facing files (Ccomment, Preproc) return an empty slice.

§Examples
use big_code_analysis::LANG;

assert!(LANG::Rust.get_extensions().contains(&"rs"));

Trait Implementations§

Source§

impl Clone for LANG

Source§

fn clone(&self) -> LANG

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 LANG

Source§

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

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

impl PartialEq for LANG

Source§

fn eq(&self, other: &LANG) -> 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 LANG

Source§

impl Eq for LANG

Source§

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 UnsafeUnpin for LANG

§

impl UnwindSafe for LANG

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. 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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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.