Skip to main content

LangRust

Struct LangRust 

Source
pub struct LangRust {}
Expand description

Language Struct Definition

Implementations§

Source§

impl LangRust

Language Constants

Source

pub const Text_fn: u16 = 96

Source

pub const Text_LPAREN: u16 = 4

Source

pub const Text_RPAREN: u16 = 5

Source

pub const Text_LBRACE: u16 = 8

Source

pub const Text_RBRACE: u16 = 9

Source

pub const Text_let: u16 = 101

Source

pub const Text_EQ: u16 = 70

Source

pub const Text_SEMI: u16 = 2

Source

pub const Text_COLON: u16 = 11

Source

pub const Text_COMMA: u16 = 83

Source

pub const Text_ARROW: u16 = 85

Source

pub const Text_EQEQ: u16 = 71

Source

pub const Text_NE: u16 = 72

Source

pub const Text_LT: u16 = 74

Source

pub const Text_GT: u16 = 73

Source

pub const Text_LE: u16 = 76

Source

pub const Text_GE: u16 = 75

Source

pub const Text_AMPAMP: u16 = 56

Source

pub const Text_PIPEPIPE: u16 = 57

Source

pub const Text_PLUS: u16 = 14

Source

pub const Text_MINUS: u16 = 49

Source

pub const Text_STAR: u16 = 15

Source

pub const Text_SLASH: u16 = 50

Source

pub const Text_PERCENT: u16 = 51

Source

pub const attribute_item: u16 = 170

Source

pub const inner_attribute_item: u16 = 171

Source

pub const attribute: u16 = 172

Source

pub const integer_literal: u16 = 127

Source

pub const float_literal: u16 = 151

Source

pub const string_literal: u16 = 311

Source

pub const boolean_literal: u16 = 313

Source

pub const char_literal: u16 = 130

Source

pub const type_identifier: u16 = 354

Source

pub const scoped_identifier: u16 = 243

Source

pub const scoped_type_identifier: u16 = 245

Source

pub const field_identifier: u16 = 351

Source

pub const shorthand_field_identifier: u16 = 353

Source

pub const identifier: u16 = 1

Source

pub const ordered_field_declaration_list: u16 = 183

Source

pub const parameter: u16 = 213

Source

pub const self_param: u16 = 211

Source

pub const self_keyword: u16 = 143

Source

pub const parameters: u16 = 210

Source

pub const let_declaration: u16 = 203

Source

pub const visibility_modifier: u16 = 215

Source

pub const field_declaration: u16 = 182

Source

pub const block: u16 = 293

Source

pub const source_file: u16 = 157

Source

pub const mod_item: u16 = 173

Source

pub const struct_item: u16 = 176

Source

pub const enum_item: u16 = 178

Source

pub const enum_variant_list: u16 = 179

Source

pub const associated_type: u16 = 195

Source

pub const type_item: u16 = 187

Source

pub const array_type: u16 = 220

Source

pub const tuple_type: u16 = 223

Source

pub const abstract_type: u16 = 235

Source

pub const bounded_type: u16 = 228

Source

pub const trait_bounds: u16 = 196

Source

pub const lifetime: u16 = 219

Source

pub const function_type: u16 = 222

Source

pub const reference_type: u16 = 232

Source

pub const pointer_type: u16 = 233

Source

pub const generic_type: u16 = 226

Source

pub const tuple_pattern: u16 = 296

Source

pub const struct_pattern: u16 = 299

Source

pub const or_pattern: u16 = 307

Source

pub const slice_pattern: u16 = 297

Source

pub const reference_pattern: u16 = 306

Source

pub const mut_pattern: u16 = 302

Source

pub const ref_pattern: u16 = 304

Source

pub const text_node: u16 = 0

Source

pub const generic_type_with_turbofish: u16 = 227

Source

pub const index_expression: u16 = 286

Source

pub const type_cast_expression: u16 = 253

Source

pub const type_parameter: u16 = 201

Source

pub const const_parameter: u16 = 200

Source

pub const where_clause: u16 = 191

Source

pub const where_predicate: u16 = 192

Source

pub const enum_variant: u16 = 180

Source

pub const impl_item: u16 = 193

Source

pub const trait_item: u16 = 194

Source

pub const const_item: u16 = 185

Source

pub const static_item: u16 = 186

Source

pub const function_item: u16 = 188

Source

pub const function_signature_item: u16 = 189

Source

pub const mutable_specifier: u16 = 122

Source

pub const expression_statement: u16 = 160

Source

pub const assignment_expression: u16 = 251

Source

pub const binary_expression: u16 = 250

Source

pub const operator: u16 = 0

Source

pub const call_expression: u16 = 256

Source

pub const reference_expression: u16 = 249

Source

pub const field_expression: u16 = 288

Source

pub const try_expression: u16 = 248

Source

pub const await_expression: u16 = 287

Source

pub const parenthesized_expression: u16 = 259

Source

pub const macro_invocation: u16 = 239

Source

pub const macro_definition: u16 = 161

Source

pub const arguments: u16 = 257

Source

pub const primitive_type: u16 = 32

Source

pub const struct_expression: u16 = 262

Source

pub const if_expression: u16 = 267

Source

pub const match_expression: u16 = 272

Source

pub const match_block: u16 = 273

Source

pub const while_expression: u16 = 277

Source

pub const loop_expression: u16 = 278

Source

pub const for_expression: u16 = 279

Source

pub const array_expression: u16 = 258

Source

pub const tuple_expression: u16 = 260

Source

pub const unit_expression: u16 = 261

Source

pub const range_expression: u16 = 246

Source

pub const unary_expression: u16 = 247

Source

pub const tuple_struct_pattern: u16 = 298

Source

pub const closure_expression: u16 = 281

Source

pub const closure_parameters: u16 = 282

Source

pub const super_token: u16 = 144

Source

pub const crate_token: u16 = 145

Source

pub const field_name: u16 = 19

Source

pub const field_type: u16 = 28

Source

pub const field_pattern: u16 = 24

Source

pub const field_return_type: u16 = 25

Source

pub const field_parameters: u16 = 22

Source

pub const field_bounds: u16 = 6

Source

pub const field_default_type: u16 = 9

Source

pub const field_macro: u16 = 18

Source

pub const field_body: u16 = 5

Source

pub const field_left: u16 = 15

Source

pub const field_right: u16 = 26

Source

pub const field_operator: u16 = 20

Source

pub const field_function: u16 = 13

Source

pub const field_arguments: u16 = 4

Source

pub const field_type_arguments: u16 = 29

Source

pub const field_value: u16 = 31

Source

pub const field_field: u16 = 12

Source

pub const field_trait: u16 = 27

Source

pub const field_element: u16 = 11

Source

pub const field_length: u16 = 16

Source

pub const field_consequence: u16 = 8

Source

pub const field_argument: u16 = 3

Source

pub const field_condition: u16 = 7

Source

pub const field_path: u16 = 23

Source

pub fn new() -> Self

Create a new Language instance

Trait Implementations§

Source§

impl Debug for LangRust

Source§

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

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

impl LanguageTrait for LangRust

Language Trait Implementation

Source§

fn parse(text: impl AsRef<[u8]>) -> Option<Box<dyn ParseTree>>

Parse source code and return a generic parse tree.

First tries the custom parse_impl from LanguageTraitImpl. If that returns None, falls back to tree-sitter parsing if available.

Source§

fn supported_extensions() -> &'static [&'static str]

Return the list of supported file extensions for this language

Source§

fn hir_kind(kind_id: u16) -> HirKind

Get the HIR kind for a given token ID

Source§

fn block_kind(kind_id: u16) -> BlockKind

Get the Block kind for a given token ID

Source§

fn block_kind_with_parent( kind_id: u16, field_id: u16, parent_kind_id: u16, ) -> BlockKind

Get the Block kind for a given token ID with parent context

Source§

fn is_test_attribute(node: &dyn ParseNode, source: &[u8]) -> bool

Check if a parse node is a test attribute that should cause the next item to be skipped

Source§

fn token_str(kind_id: u16) -> Option<&'static str>

Get the string representation of a token ID

Source§

fn is_valid_token(kind_id: u16) -> bool

Check if a token ID is valid

Source§

fn manifest_name() -> &'static str

Get the manifest file name for this language (e.g., “Cargo.toml”, “package.json”).
Source§

fn container_dirs() -> &'static [&'static str]

Get the container directories that don’t add semantic meaning. These directories are skipped in module detection (e.g., “src”, “lib”).
Source§

fn collect_init<'tcx>(cc: &'tcx CompileCtxt<'tcx>) -> ScopeStack<'tcx>

Source§

fn collect_symbols<'tcx, C>( unit: CompileUnit<'tcx>, node: HirNode<'tcx>, scope_stack: ScopeStack<'tcx>, config: &C, ) -> &'tcx Scope<'tcx>

TOOD: can we remove the generics here, we could make a new crate or bring llmcc-resolver into core to solve the cross dependency
Source§

fn bind_symbols<'tcx, C>( unit: CompileUnit<'tcx>, node: HirNode<'tcx>, globals: &'tcx Scope<'tcx>, config: &C, )

Source§

fn name_field() -> u16

Get the field ID that represents the “name” of a construct.
Source§

fn type_field() -> u16

Get the field ID that represents the “type” of a construct.
Source§

fn trait_field() -> u16

Get the field ID that represents the “trait” in impl blocks. Used for impl Trait for Type { } to identify the trait being implemented.
Source§

fn is_container(name: &str) -> bool

Check if a directory name is a container directory.
Source§

impl LanguageTraitImpl for LangRust

Source§

fn block_kind_with_parent_impl( kind_id: u16, field_id: u16, parent_kind_id: u16, ) -> BlockKind

Block kind with parent context - handles tuple struct fields

Source§

fn is_test_attribute_impl(node: &dyn ParseNode, source: &[u8]) -> bool

Check if the given parse node is a Rust test attribute. Detects: #test, #[cfg(test)], #[tokio::test], #[async_std::test], etc.

Source§

fn collect_init_impl<'tcx>(cc: &'tcx CompileCtxt<'tcx>) -> ScopeStack<'tcx>

Source§

fn parse_impl(text: impl AsRef<[u8]>) -> Option<Box<dyn ParseTree>>

Custom parse implementation for this language.
Source§

fn supported_extensions_impl() -> &'static [&'static str]

Supported file extensions for this language.
Source§

fn manifest_name_impl() -> &'static str

The manifest file name for this language (e.g., “Cargo.toml”, “package.json”).
Source§

fn container_dirs_impl() -> &'static [&'static str]

Container directories that don’t add semantic meaning (e.g., “src”, “lib”).
Source§

fn collect_symbols_impl<'tcx, C>( unit: CompileUnit<'tcx>, node: HirNode<'tcx>, scope_stack: ScopeStack<'tcx>, config: &C, ) -> &'tcx Scope<'tcx>

Source§

fn bind_symbols_impl<'tcx, C>( unit: CompileUnit<'tcx>, node: HirNode<'tcx>, globals: &'tcx Scope<'tcx>, config: &C, )

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more