Skip to main content

NodeKind

Enum NodeKind 

Source
pub enum NodeKind {
Show 58 variants File, Error, Import, Struct, Field, TypeDecl, Variant, FnDecl, ParamList, Param, Let, Body, Attr, AttrPath, Block, Include, IfStmt, ForStmt, Literal, Str, Interp, Name, Symbol, SelfExpr, List, ListComp, Map, MapEntry, MapComp, StructLit, Paren, Call, ArgList, Arg, FieldExpr, IndexExpr, BinaryExpr, UnaryExpr, IfExpr, MatchExpr, MatchArm, LetExpr, Binding, Lambda, PartExpr, TypePath, NamedType, TypeArgList, FnType, RefinedType, RangePredicate, NamedPredicate, WildcardPat, LiteralPat, NamePat, VariantPat, FieldPat, OrPat,
}
Expand description

The kind of a SyntaxNode.

Variants§

§

File

A whole source file: its declarations and statements.

§

Error

Tokens that could not be parsed. A diagnostic always explains them, unless the lexer already reported the tokens themselves.

§

Import

import "path" as alias.

§

Struct

struct Name { fields }.

§

Field

A field of a struct: name: Type = default block kind.

§

TypeDecl

type Name = variant | variant.

§

Variant

A variant of a sum type, with an optional parameter list.

§

FnDecl

fn name(params) -> Type = body.

§

ParamList

The parenthesized parameters of a function, lambda or variant.

§

Param

A parameter: name: Type = default.

§

Let

let name: Type = value, as a statement or a top-level declaration.

§

Body

{ statements }, the body of a block, an if, a for or a part.

§

Attr

path = value.

§

AttrPath

The dotted path of an attribute statement, such as a.b."c".

§

Block

kind label { body }, with an optional label.

§

Include

include value.

§

IfStmt

if condition { body } else { body } as a statement.

§

ForStmt

for name in collection { body }.

§

Literal

A literal token: an integer, a float, a path, true, false or none.

§

Str

A string in any of its forms, including its interpolations.

§

Interp

#{ expression } inside a string.

§

Name

An identifier in expression position.

§

Symbol

A symbol word such as compiler@19:static in expression position.

§

SelfExpr

self.

§

List

[items].

§

ListComp

[for x in xs if guard -> value].

§

Map

{ key = value }, a map literal or a struct literal without a type name.

§

MapEntry

key = value inside a map or struct literal.

§

MapComp

{for x in xs if guard -> key = value}.

§

StructLit

Type { key = value }.

§

Paren

(expression).

§

Call

callee(arguments).

§

ArgList

The parenthesized arguments of a call or a predicate.

§

Arg

An argument, positional or named as in name = value.

§

FieldExpr

base.field or base?.field.

§

IndexExpr

base[index].

§

BinaryExpr

lhs op rhs.

§

UnaryExpr

!operand or -operand.

§

IfExpr

if condition { value } else { value } as an expression.

§

MatchExpr

match scrutinee { arms }.

§

MatchArm

pattern if guard => value inside a match.

§

LetExpr

let bindings in body.

§

Binding

name: Type = value inside a let ... in expression.

§

Lambda

fn(params) -> Type = body.

§

PartExpr

part { body }.

§

TypePath

The name of a type, optionally qualified: Str or alias.Type.

§

NamedType

A type name with optional type arguments, such as Map<Str, Int>.

§

TypeArgList

<types> after a type name.

§

FnType

Fn(types) -> Type.

§

RefinedType

Type where predicate && predicate.

§

RangePredicate

A range predicate such as 1..=16, ..5 or 0...

§

NamedPredicate

A named predicate such as nonEmpty or matches(r"...").

§

WildcardPat

_.

§

LiteralPat

A literal pattern: an integer, a string, true, false or none.

§

NamePat

A name pattern: a binder or a nullary variant, optionally qualified.

§

VariantPat

A variant pattern with field patterns, such as check(cmd, ..).

§

FieldPat

name or name = pattern inside a variant pattern.

§

OrPat

pattern | pattern.

Trait Implementations§

Source§

impl Clone for NodeKind

Source§

fn clone(&self) -> Self

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 Copy for NodeKind

Source§

impl Debug for NodeKind

Source§

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

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

impl Eq for NodeKind

Source§

impl Hash for NodeKind

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 NodeKind

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for NodeKind

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> 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 = !

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.