syntax

Enum SyntaxKind

source
#[repr(u16)]
pub enum SyntaxKind {
Show 316 variants DOLLAR, SEMICOLON, COMMA, L_PAREN, R_PAREN, L_CURLY, R_CURLY, L_BRACK, R_BRACK, L_ANGLE, R_ANGLE, AT, POUND, TILDE, QUESTION, AMP, PIPE, PLUS, STAR, SLASH, CARET, PERCENT, UNDERSCORE, DOT, DOT2, DOT3, DOT2EQ, COLON, COLON2, EQ, EQ2, FAT_ARROW, BANG, NEQ, MINUS, THIN_ARROW, LTEQ, GTEQ, PLUSEQ, MINUSEQ, PIPEEQ, AMPEQ, CARETEQ, SLASHEQ, STAREQ, PERCENTEQ, AMP2, PIPE2, SHL, SHR, SHLEQ, SHREQ, SELF_TYPE_KW, ABSTRACT_KW, AS_KW, BECOME_KW, BOX_KW, BREAK_KW, CONST_KW, CONTINUE_KW, CRATE_KW, DO_KW, ELSE_KW, ENUM_KW, EXTERN_KW, FALSE_KW, FINAL_KW, FN_KW, FOR_KW, IF_KW, IMPL_KW, IN_KW, LET_KW, LOOP_KW, MACRO_KW, MATCH_KW, MOD_KW, MOVE_KW, MUT_KW, OVERRIDE_KW, PRIV_KW, PUB_KW, REF_KW, RETURN_KW, SELF_KW, STATIC_KW, STRUCT_KW, SUPER_KW, TRAIT_KW, TRUE_KW, TYPE_KW, TYPEOF_KW, UNSAFE_KW, UNSIZED_KW, USE_KW, VIRTUAL_KW, WHERE_KW, WHILE_KW, YIELD_KW, ASM_KW, ASYNC_KW, ATT_SYNTAX_KW, AUTO_KW, AWAIT_KW, BUILTIN_KW, CLOBBER_ABI_KW, DEFAULT_KW, DYN_KW, FORMAT_ARGS_KW, GEN_KW, INLATEOUT_KW, INOUT_KW, LABEL_KW, LATEOUT_KW, MACRO_RULES_KW, MAY_UNWIND_KW, NOMEM_KW, NORETURN_KW, NOSTACK_KW, OFFSET_OF_KW, OPTIONS_KW, OUT_KW, PRESERVES_FLAGS_KW, PURE_KW, RAW_KW, READONLY_KW, SAFE_KW, SYM_KW, TRY_KW, UNION_KW, YEET_KW, BYTE, BYTE_STRING, CHAR, C_STRING, FLOAT_NUMBER, INT_NUMBER, RAW_BYTE_STRING, RAW_C_STRING, RAW_STRING, STRING, COMMENT, ERROR, IDENT, LIFETIME_IDENT, NEWLINE, SHEBANG, WHITESPACE, ABI, ADT, ARG_LIST, ARRAY_EXPR, ARRAY_TYPE, ASM_CLOBBER_ABI, ASM_CONST, ASM_DIR_SPEC, ASM_EXPR, ASM_LABEL, ASM_OPERAND, ASM_OPERAND_EXPR, ASM_OPERAND_NAMED, ASM_OPTION, ASM_OPTIONS, ASM_PIECE, ASM_REG_OPERAND, ASM_REG_SPEC, ASM_SYM, ASSOC_ITEM, ASSOC_ITEM_LIST, ASSOC_TYPE_ARG, ATTR, AWAIT_EXPR, BECOME_EXPR, BIN_EXPR, BLOCK_EXPR, BOX_PAT, BREAK_EXPR, CALL_EXPR, CAST_EXPR, CLOSURE_BINDER, CLOSURE_EXPR, CONST, CONST_ARG, CONST_BLOCK_PAT, CONST_PARAM, CONTINUE_EXPR, DYN_TRAIT_TYPE, ENUM, EXPR, EXPR_STMT, EXTERN_BLOCK, EXTERN_CRATE, EXTERN_ITEM, EXTERN_ITEM_LIST, FIELD_EXPR, FIELD_LIST, FN, FN_PTR_TYPE, FORMAT_ARGS_ARG, FORMAT_ARGS_EXPR, FOR_EXPR, FOR_TYPE, GENERIC_ARG, GENERIC_ARG_LIST, GENERIC_PARAM, GENERIC_PARAM_LIST, IDENT_PAT, IF_EXPR, IMPL, IMPL_TRAIT_TYPE, INDEX_EXPR, INFER_TYPE, ITEM, ITEM_LIST, LABEL, LET_ELSE, LET_EXPR, LET_STMT, LIFETIME, LIFETIME_ARG, LIFETIME_PARAM, LITERAL, LITERAL_PAT, LOOP_EXPR, MACRO_CALL, MACRO_DEF, MACRO_EXPR, MACRO_ITEMS, MACRO_PAT, MACRO_RULES, MACRO_STMTS, MACRO_TYPE, MATCH_ARM, MATCH_ARM_LIST, MATCH_EXPR, MATCH_GUARD, META, METHOD_CALL_EXPR, MODULE, NAME, NAME_REF, NEVER_TYPE, OFFSET_OF_EXPR, OR_PAT, PARAM, PARAM_LIST, PARENTHESIZED_ARG_LIST, PAREN_EXPR, PAREN_PAT, PAREN_TYPE, PAT, PATH, PATH_EXPR, PATH_PAT, PATH_SEGMENT, PATH_TYPE, PREFIX_EXPR, PTR_TYPE, RANGE_EXPR, RANGE_PAT, RECORD_EXPR, RECORD_EXPR_FIELD, RECORD_EXPR_FIELD_LIST, RECORD_FIELD, RECORD_FIELD_LIST, RECORD_PAT, RECORD_PAT_FIELD, RECORD_PAT_FIELD_LIST, REF_EXPR, REF_PAT, REF_TYPE, RENAME, REST_PAT, RETURN_EXPR, RETURN_TYPE_SYNTAX, RET_TYPE, SELF_PARAM, SLICE_PAT, SLICE_TYPE, SOURCE_FILE, STATIC, STMT, STMT_LIST, STRUCT, TOKEN_TREE, TRAIT, TRAIT_ALIAS, TRY_EXPR, TUPLE_EXPR, TUPLE_FIELD, TUPLE_FIELD_LIST, TUPLE_PAT, TUPLE_STRUCT_PAT, TUPLE_TYPE, TYPE, TYPE_ALIAS, TYPE_ARG, TYPE_BOUND, TYPE_BOUND_LIST, TYPE_PARAM, UNDERSCORE_EXPR, UNION, USE, USE_BOUND_GENERIC_ARG, USE_BOUND_GENERIC_ARGS, USE_TREE, USE_TREE_LIST, VARIANT, VARIANT_LIST, VISIBILITY, WHERE_CLAUSE, WHERE_PRED, WHILE_EXPR, WILDCARD_PAT, YEET_EXPR, YIELD_EXPR, // some variants omitted
}
Expand description

The kind of syntax node, e.g. IDENT, USE_KW, or STRUCT.

Variants§

§

DOLLAR

§

SEMICOLON

§

COMMA

§

L_PAREN

§

R_PAREN

§

L_CURLY

§

R_CURLY

§

L_BRACK

§

R_BRACK

§

L_ANGLE

§

R_ANGLE

§

AT

§

POUND

§

TILDE

§

QUESTION

§

AMP

§

PIPE

§

PLUS

§

STAR

§

SLASH

§

CARET

§

PERCENT

§

UNDERSCORE

§

DOT

§

DOT2

§

DOT3

§

DOT2EQ

§

COLON

§

COLON2

§

EQ

§

EQ2

§

FAT_ARROW

§

BANG

§

NEQ

§

MINUS

§

THIN_ARROW

§

LTEQ

§

GTEQ

§

PLUSEQ

§

MINUSEQ

§

PIPEEQ

§

AMPEQ

§

CARETEQ

§

SLASHEQ

§

STAREQ

§

PERCENTEQ

§

AMP2

§

PIPE2

§

SHL

§

SHR

§

SHLEQ

§

SHREQ

§

SELF_TYPE_KW

§

ABSTRACT_KW

§

AS_KW

§

BECOME_KW

§

BOX_KW

§

BREAK_KW

§

CONST_KW

§

CONTINUE_KW

§

CRATE_KW

§

DO_KW

§

ELSE_KW

§

ENUM_KW

§

EXTERN_KW

§

FALSE_KW

§

FINAL_KW

§

FN_KW

§

FOR_KW

§

IF_KW

§

IMPL_KW

§

IN_KW

§

LET_KW

§

LOOP_KW

§

MACRO_KW

§

MATCH_KW

§

MOD_KW

§

MOVE_KW

§

MUT_KW

§

OVERRIDE_KW

§

PRIV_KW

§

PUB_KW

§

REF_KW

§

RETURN_KW

§

SELF_KW

§

STATIC_KW

§

STRUCT_KW

§

SUPER_KW

§

TRAIT_KW

§

TRUE_KW

§

TYPE_KW

§

TYPEOF_KW

§

UNSAFE_KW

§

UNSIZED_KW

§

USE_KW

§

VIRTUAL_KW

§

WHERE_KW

§

WHILE_KW

§

YIELD_KW

§

ASM_KW

§

ASYNC_KW

§

ATT_SYNTAX_KW

§

AUTO_KW

§

AWAIT_KW

§

BUILTIN_KW

§

CLOBBER_ABI_KW

§

DEFAULT_KW

§

DYN_KW

§

FORMAT_ARGS_KW

§

GEN_KW

§

INLATEOUT_KW

§

INOUT_KW

§

LABEL_KW

§

LATEOUT_KW

§

MACRO_RULES_KW

§

MAY_UNWIND_KW

§

NOMEM_KW

§

NORETURN_KW

§

NOSTACK_KW

§

OFFSET_OF_KW

§

OPTIONS_KW

§

OUT_KW

§

PRESERVES_FLAGS_KW

§

PURE_KW

§

RAW_KW

§

READONLY_KW

§

SAFE_KW

§

SYM_KW

§

TRY_KW

§

UNION_KW

§

YEET_KW

§

BYTE

§

BYTE_STRING

§

CHAR

§

C_STRING

§

FLOAT_NUMBER

§

INT_NUMBER

§

RAW_BYTE_STRING

§

RAW_C_STRING

§

RAW_STRING

§

STRING

§

COMMENT

§

ERROR

§

IDENT

§

LIFETIME_IDENT

§

NEWLINE

§

SHEBANG

§

WHITESPACE

§

ABI

§

ADT

§

ARG_LIST

§

ARRAY_EXPR

§

ARRAY_TYPE

§

ASM_CLOBBER_ABI

§

ASM_CONST

§

ASM_DIR_SPEC

§

ASM_EXPR

§

ASM_LABEL

§

ASM_OPERAND

§

ASM_OPERAND_EXPR

§

ASM_OPERAND_NAMED

§

ASM_OPTION

§

ASM_OPTIONS

§

ASM_PIECE

§

ASM_REG_OPERAND

§

ASM_REG_SPEC

§

ASM_SYM

§

ASSOC_ITEM

§

ASSOC_ITEM_LIST

§

ASSOC_TYPE_ARG

§

ATTR

§

AWAIT_EXPR

§

BECOME_EXPR

§

BIN_EXPR

§

BLOCK_EXPR

§

BOX_PAT

§

BREAK_EXPR

§

CALL_EXPR

§

CAST_EXPR

§

CLOSURE_BINDER

§

CLOSURE_EXPR

§

CONST

§

CONST_ARG

§

CONST_BLOCK_PAT

§

CONST_PARAM

§

CONTINUE_EXPR

§

DYN_TRAIT_TYPE

§

ENUM

§

EXPR

§

EXPR_STMT

§

EXTERN_BLOCK

§

EXTERN_CRATE

§

EXTERN_ITEM

§

EXTERN_ITEM_LIST

§

FIELD_EXPR

§

FIELD_LIST

§

FN

§

FN_PTR_TYPE

§

FORMAT_ARGS_ARG

§

FORMAT_ARGS_EXPR

§

FOR_EXPR

§

FOR_TYPE

§

GENERIC_ARG

§

GENERIC_ARG_LIST

§

GENERIC_PARAM

§

GENERIC_PARAM_LIST

§

IDENT_PAT

§

IF_EXPR

§

IMPL

§

IMPL_TRAIT_TYPE

§

INDEX_EXPR

§

INFER_TYPE

§

ITEM

§

ITEM_LIST

§

LABEL

§

LET_ELSE

§

LET_EXPR

§

LET_STMT

§

LIFETIME

§

LIFETIME_ARG

§

LIFETIME_PARAM

§

LITERAL

§

LITERAL_PAT

§

LOOP_EXPR

§

MACRO_CALL

§

MACRO_DEF

§

MACRO_EXPR

§

MACRO_ITEMS

§

MACRO_PAT

§

MACRO_RULES

§

MACRO_STMTS

§

MACRO_TYPE

§

MATCH_ARM

§

MATCH_ARM_LIST

§

MATCH_EXPR

§

MATCH_GUARD

§

META

§

METHOD_CALL_EXPR

§

MODULE

§

NAME

§

NAME_REF

§

NEVER_TYPE

§

OFFSET_OF_EXPR

§

OR_PAT

§

PARAM

§

PARAM_LIST

§

PARENTHESIZED_ARG_LIST

§

PAREN_EXPR

§

PAREN_PAT

§

PAREN_TYPE

§

PAT

§

PATH

§

PATH_EXPR

§

PATH_PAT

§

PATH_SEGMENT

§

PATH_TYPE

§

PREFIX_EXPR

§

PTR_TYPE

§

RANGE_EXPR

§

RANGE_PAT

§

RECORD_EXPR

§

RECORD_EXPR_FIELD

§

RECORD_EXPR_FIELD_LIST

§

RECORD_FIELD

§

RECORD_FIELD_LIST

§

RECORD_PAT

§

RECORD_PAT_FIELD

§

RECORD_PAT_FIELD_LIST

§

REF_EXPR

§

REF_PAT

§

REF_TYPE

§

RENAME

§

REST_PAT

§

RETURN_EXPR

§

RETURN_TYPE_SYNTAX

§

RET_TYPE

§

SELF_PARAM

§

SLICE_PAT

§

SLICE_TYPE

§

SOURCE_FILE

§

STATIC

§

STMT

§

STMT_LIST

§

STRUCT

§

TOKEN_TREE

§

TRAIT

§

TRAIT_ALIAS

§

TRY_EXPR

§

TUPLE_EXPR

§

TUPLE_FIELD

§

TUPLE_FIELD_LIST

§

TUPLE_PAT

§

TUPLE_STRUCT_PAT

§

TUPLE_TYPE

§

TYPE

§

TYPE_ALIAS

§

TYPE_ARG

§

TYPE_BOUND

§

TYPE_BOUND_LIST

§

TYPE_PARAM

§

UNDERSCORE_EXPR

§

UNION

§

USE

§

USE_BOUND_GENERIC_ARG

§

USE_BOUND_GENERIC_ARGS

§

USE_TREE

§

USE_TREE_LIST

§

VARIANT

§

VARIANT_LIST

§

VISIBILITY

§

WHERE_CLAUSE

§

WHERE_PRED

§

WHILE_EXPR

§

WILDCARD_PAT

§

YEET_EXPR

§

YIELD_EXPR

Implementations§

source§

impl SyntaxKind

source

pub fn is_strict_keyword(self, edition: Edition) -> bool

Checks whether this syntax kind is a strict keyword for the given edition. Strict keywords are identifiers that are always considered keywords.

source

pub fn is_contextual_keyword(self, edition: Edition) -> bool

Checks whether this syntax kind is a weak keyword for the given edition. Weak keywords are identifiers that are considered keywords only in certain contexts.

source

pub fn is_keyword(self, edition: Edition) -> bool

Checks whether this syntax kind is a strict or weak keyword for the given edition.

source

pub fn is_punct(self) -> bool

source

pub fn is_literal(self) -> bool

source

pub fn from_keyword(ident: &str, edition: Edition) -> Option<SyntaxKind>

source

pub fn from_contextual_keyword( ident: &str, edition: Edition, ) -> Option<SyntaxKind>

source

pub fn from_char(c: char) -> Option<SyntaxKind>

source§

impl SyntaxKind

source

pub fn is_trivia(self) -> bool

source

pub fn is_any_identifier(self) -> bool

Returns true if this is an identifier or a keyword.

Trait Implementations§

source§

impl Clone for SyntaxKind

source§

fn clone(&self) -> SyntaxKind

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for SyntaxKind

source§

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

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

impl From<u16> for SyntaxKind

source§

fn from(d: u16) -> SyntaxKind

Converts to this type from the input type.
source§

impl Hash for SyntaxKind

source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

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 Ord for SyntaxKind

source§

fn cmp(&self, other: &SyntaxKind) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
source§

impl PartialEq for SyntaxKind

source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · 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 PartialOrd for SyntaxKind

source§

fn partial_cmp(&self, other: &SyntaxKind) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl Copy for SyntaxKind

source§

impl Eq for SyntaxKind

source§

impl StructuralPartialEq for SyntaxKind

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, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
§

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

§

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.

§

impl<T> Instrument for T

§

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

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

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> IntoBox<dyn Any> for T
where T: Any,

source§

fn into_box(self) -> Box<dyn Any>

Convert self into the appropriate boxed form.
source§

impl<T> IntoBox<dyn Any + Send> for T
where T: Any + Send,

source§

fn into_box(self) -> Box<dyn Any + Send>

Convert self into the appropriate boxed form.
source§

impl<T> IntoBox<dyn Any + Sync + Send> for T
where T: Any + Send + Sync,

source§

fn into_box(self) -> Box<dyn Any + Sync + Send>

Convert self into the appropriate boxed form.
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> 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.
§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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