pub enum CodeNodeKind {
Show 35 variants
File,
Module,
Class,
Function,
Method,
Parameter,
Variable,
Test,
Type,
Constant,
Import,
RustFn,
RustMethod,
RustImpl,
RustTrait,
RustStruct,
RustEnum,
RustMod,
RustMacro,
RustUse,
RustConst,
RustStatic,
RustTypeAlias,
RustAttribute,
RustLifetime,
RustTest,
PythonFunction,
PythonMethod,
PythonClass,
PythonDecorator,
PythonImport,
PythonModule,
PythonLambda,
PythonAsync,
PythonProperty,
}Expand description
Kind of code object.
Variants are stored as Arrow Dictionary<Int8, Utf8> for efficient memory use.
§Variant groups
Language-agnostic (original set — used by the Python parser):
File, Module, Class, Function, Method, Parameter, Variable, Test
Generic (EX-3168 / V12a-1 — language-independent additions):
Type, Constant, Import
Rust-specific (EX-3168 / V12a-1 — populated by tree-sitter parser in EX-3120):
RustFn, RustMethod, RustImpl, RustTrait, RustStruct, RustEnum,
RustMod, RustMacro, RustUse, RustConst, RustStatic, RustTypeAlias,
RustAttribute, RustLifetime, RustTest
Python-specific (EX-3172 / V12b-1 — populated by PythonParser with position metadata):
PythonFunction, PythonMethod, PythonClass, PythonDecorator, PythonImport,
PythonModule, PythonLambda, PythonAsync, PythonProperty
Variants§
File
Module
Class
Function
Method
Parameter
Variable
Test
Type
Named type (struct, class, enum — language-agnostic abstraction)
Constant
Compile-time or declaration-time constant value
Import
Module import / use declaration
RustFn
fn foo() — free function
RustMethod
fn method(&self) inside an impl block
RustImpl
impl Foo { ... } or impl Trait for Foo { ... }
RustTrait
trait Foo { ... }
RustStruct
struct Foo { ... }
RustEnum
enum Foo { ... }
RustMod
mod foo { ... } or mod foo;
RustMacro
macro_rules! name { ... }
RustUse
use path::to::Item;
RustConst
const NAME: Type = value;
RustStatic
static NAME: Type = value;
RustTypeAlias
type Foo = Bar;
RustAttribute
#[derive(...)] or other attributes (stored separately from node)
RustLifetime
Lifetime parameter 'a in fn / struct / impl
RustTest
#[test] fn test_foo() { ... }
PythonFunction
def foo(...): — top-level function
PythonMethod
def method(self, ...): inside a class body
PythonClass
class Foo: — class definition
PythonDecorator
@dataclass, @property, @classmethod etc. — decorator node
PythonImport
import x or from x import y — import statement
PythonModule
Top-level file module (file as a Python module)
PythonLambda
lambda x: ... — anonymous function expression
PythonAsync
async def foo(): — async function or method
PythonProperty
Method decorated with @property
Implementations§
Source§impl CodeNodeKind
impl CodeNodeKind
Sourcepub const ALL: [CodeNodeKind; 35]
pub const ALL: [CodeNodeKind; 35]
All 35 variants in stable order — used to build the Arrow Dictionary<Int8, Utf8>. Int8 supports up to 127 unique values; 35 variants is well within range.
pub fn as_str(self) -> &'static str
pub fn parse(s: &str) -> Option<Self>
Sourcepub fn is_rust_specific(self) -> bool
pub fn is_rust_specific(self) -> bool
Whether this kind is Rust-specific (introduced by EX-3168 / V12a-1).
Sourcepub fn is_python_specific(self) -> bool
pub fn is_python_specific(self) -> bool
Whether this kind is Python-specific (introduced by EX-3172 / V12b-1).
Trait Implementations§
Source§impl Clone for CodeNodeKind
impl Clone for CodeNodeKind
Source§fn clone(&self) -> CodeNodeKind
fn clone(&self) -> CodeNodeKind
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for CodeNodeKind
Source§impl Debug for CodeNodeKind
impl Debug for CodeNodeKind
Source§impl Display for CodeNodeKind
impl Display for CodeNodeKind
impl Eq for CodeNodeKind
Source§impl Hash for CodeNodeKind
impl Hash for CodeNodeKind
Source§impl PartialEq for CodeNodeKind
impl PartialEq for CodeNodeKind
Source§fn eq(&self, other: &CodeNodeKind) -> bool
fn eq(&self, other: &CodeNodeKind) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for CodeNodeKind
Auto Trait Implementations§
impl Freeze for CodeNodeKind
impl RefUnwindSafe for CodeNodeKind
impl Send for CodeNodeKind
impl Sync for CodeNodeKind
impl Unpin for CodeNodeKind
impl UnsafeUnpin for CodeNodeKind
impl UnwindSafe for CodeNodeKind
Blanket Implementations§
impl<T> Allocation for T
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,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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.