rune::ast

Enum Kind

Source
pub enum Kind {
Show 197 variants Eof, Comment, MultilineComment(bool), Error, Shebang(LitSource), Close(Delimiter), Open(Delimiter), Ident(LitSource), Label(LitSource), Byte(CopySource<u8>), ByteStr(StrSource), Char(CopySource<char>), Number(NumberSource), Str(StrSource), IndexedPath(ItemId), ConstBlock(ItemId), AsyncBlock(ItemId), Closure(ItemId), ExpandedMacro(NonZeroId), Abstract, AlignOf, Amp, AmpAmp, AmpEq, Arrow, As, Async, At, Await, Bang, BangEq, Become, Break, Caret, CaretEq, Colon, ColonColon, Comma, Const, Continue, Crate, Dash, DashEq, Default, Div, Do, Dollar, Dot, DotDot, DotDotEq, Else, Enum, Eq, EqEq, Extern, False, Final, Fn, For, Gt, GtEq, GtGt, GtGtEq, If, Impl, In, Is, Let, Loop, Lt, LtEq, LtLt, LtLtEq, Macro, Match, Mod, Move, Mut, Not, OffsetOf, Override, Perc, PercEq, Pipe, PipeEq, PipePipe, Plus, PlusEq, Pound, Priv, Proc, Pub, Pure, QuestionMark, Ref, Return, Rocket, Select, SelfType, SelfValue, SemiColon, SizeOf, SlashEq, Star, StarEq, Static, Struct, Super, Tilde, True, TypeOf, Underscore, Unsafe, Use, Virtual, While, Yield, Whitespace, Root, Local, Item, ItemEnum, ItemStruct, ItemConst, ItemFn, ItemImpl, ItemMod, ItemFileMod, ItemUse, ItemUsePath, ItemUseGroup, Variant, Field, EmptyBody, StructBody, TupleBody, FnArgs, Block, BlockBody, Expr, ExprChain, ExprTuple, ExprArray, ExprUnary, ExprBinary, ExprGroup, ExprEmptyGroup, ExprTry, ExprIndex, ExprCall, ExprMacroCall, ExprObject, ExprMatch, ExprMatchArm, ExprSelect, ExprSelectArm, ExprAwait, ExprField, ExprOperator, ExprIf, ExprElse, ExprElseIf, ExprWhile, ExprLoop, ExprBreak, ExprContinue, ExprReturn, ExprYield, ExprFor, ExprRange, ExprRangeInclusive, ExprRangeTo, ExprRangeToInclusive, ExprRangeFrom, ExprRangeFull, ExprAssign, Lit, ExprClosure, Pat, PatArray, PatTuple, PatObject, PatIgnore, Path, PathGenerics, Condition, ClosureArguments, AnonymousObjectKey, Attribute, InnerAttribute, Modifiers, ModifierSuper, ModifierSelf, ModifierCrate, ModifierIn, TokenStream, TemplateString,
}
Expand description

The kind of the token.

Variants§

§

Eof

En end-of-file marker.

§

Comment

A single-line comment.

§

MultilineComment(bool)

A multiline comment where the boolean indicates if it’s been terminated correctly.

§

Error

En error marker.

§

Shebang(LitSource)

The special initial line of a file shebang.

§

Close(Delimiter)

A close delimiter: ), }, or ].

§

Open(Delimiter)

An open delimiter: (, {, or [.

§

Ident(LitSource)

An identifier.

§

Label(LitSource)

A label, like 'loop.

§

Byte(CopySource<u8>)

A byte literal.

§

ByteStr(StrSource)

A byte string literal, including escape sequences. Like b"hello\nworld".

§

Char(CopySource<char>)

A characer literal.

§

Number(NumberSource)

A number literal, like 42 or 3.14 or 0xff.

§

Str(StrSource)

A string literal, including escape sequences. Like "hello\nworld".

§

IndexedPath(ItemId)

A path with an associated item.

§

ConstBlock(ItemId)

A constant block with an associated item.

§

AsyncBlock(ItemId)

An asynchronous block with an associated item.

§

Closure(ItemId)

An indexed closure.

§

ExpandedMacro(NonZeroId)

An expanded macro.

§

Abstract

The abstract keyword.

§

AlignOf

The alignof keyword.

§

Amp

&.

§

AmpAmp

&&.

§

AmpEq

&=.

§

Arrow

->.

§

As

The as keyword.

§

Async

The async keyword.

§

At

@.

§

Await

The await keyword.

§

Bang

!.

§

BangEq

!=.

§

Become

The become keyword.

§

Break

The break keyword.

§

Caret

^.

§

CaretEq

^=.

§

Colon

:.

§

ColonColon

::.

§

Comma

,.

§

Const

The const keyword.

§

Continue

The continue keyword.

§

Crate

The crate keyword.

§

Dash

-.

§

DashEq

-=.

§

Default

The default keyword.

§

Div

/.

§

Do

The do keyword.

§

Dollar

$.

§

Dot

..

§

DotDot

...

§

DotDotEq

..=.

§

Else

The else keyword.

§

Enum

The enum keyword.

§

Eq

=.

§

EqEq

==.

§

Extern

The extern keyword.

§

False

The false keyword.

§

Final

The final keyword.

§

Fn

The fn keyword.

§

For

The for keyword.

§

Gt

>.

§

GtEq

>=.

§

GtGt

>>.

§

GtGtEq

>>=.

§

If

The if keyword.

§

Impl

The impl keyword.

§

In

The in keyword.

§

Is

The is keyword.

§

Let

The let keyword.

§

Loop

The loop keyword.

§

Lt

<.

§

LtEq

<=.

§

LtLt

<<.

§

LtLtEq

<<=.

§

Macro

The macro keyword.

§

Match

The match keyword.

§

Mod

The mod keyword.

§

Move

The move keyword.

§

Mut

The mut keyword.

§

Not

The not keyword.

§

OffsetOf

The offsetof keyword.

§

Override

The override keyword.

§

Perc

%.

§

PercEq

%=.

§

Pipe

|.

§

PipeEq

|=`.

§

PipePipe

||.

§

Plus

+.

§

PlusEq

+=.

§

Pound

#.

§

Priv

The priv keyword.

§

Proc

The proc keyword.

§

Pub

The pub keyword.

§

Pure

The pure keyword.

§

QuestionMark

?.

§

Ref

The ref keyword.

§

Return

The return keyword.

§

Rocket

=>.

§

Select

The select keyword.

§

SelfType

The Self keyword.

§

SelfValue

The self keyword.

§

SemiColon

;.

§

SizeOf

The sizeof keyword.

§

SlashEq

/=.

§

Star

*.

§

StarEq

*=.

§

Static

The static keyword.

§

Struct

The struct keyword.

§

Super

The super keyword.

§

Tilde

~.

§

True

The true keyword.

§

TypeOf

The typeof keyword.

§

Underscore

_.

§

Unsafe

The unsafe keyword.

§

Use

The use keyword.

§

Virtual

The virtual keyword.

§

While

The while keyword.

§

Yield

The yield keyword.

§

Whitespace

whitespace.

§

Root

a syntax root

§

Local

a variable declaration

§

Item

an item declaration

§

ItemEnum

an enum declaration

§

ItemStruct

a struct declaration

§

ItemConst

a constant item

§

ItemFn

a function declaration

§

ItemImpl

an impl

§

ItemMod

a module declaration

§

ItemFileMod

a file module declaration

§

ItemUse

a use declaration

§

ItemUsePath

a nested use path

§

ItemUseGroup

a nested use group

§

Variant

a variant

§

Field

a field declaration

§

EmptyBody

an empty type body

§

StructBody

a struct body

§

TupleBody

a tuple body

§

FnArgs

a collection of function arguments

§

Block

a block

§

BlockBody

the body of a block

§

Expr

an expression

§

ExprChain

a chain of expressions

§

ExprTuple

a tuple expression

§

ExprArray

an array expression

§

ExprUnary

a unary expression

§

ExprBinary

a binary expression

§

ExprGroup

a group expression

§

ExprEmptyGroup

an empty group expression

§

ExprTry

a try expression

§

ExprIndex

an indexing expression

§

ExprCall

a call expression

§

ExprMacroCall

a macro call expression

§

ExprObject

an anonymous object expression

§

ExprMatch

a match expression

§

ExprMatchArm

a match arm

§

ExprSelect

a select expression

§

ExprSelectArm

a select arm

§

ExprAwait

an .await expression

§

ExprField

a field expression

§

ExprOperator

the operator in an expression

§

ExprIf

an if expression

§

ExprElse

the else part of an if-expression

§

ExprElseIf

the else if part of an if-expression

§

ExprWhile

a while expression

§

ExprLoop

a loop expression

§

ExprBreak

a break expression

§

ExprContinue

a break expression

§

ExprReturn

a return expression

§

ExprYield

a yield expression

§

ExprFor

a for expression

§

ExprRange

a <start>..<end> expression

§

ExprRangeInclusive

a <start>..=<end> expression

§

ExprRangeTo

a ..<end> expression

§

ExprRangeToInclusive

a ..=<end> expression

§

ExprRangeFrom

a <start>.. expression

§

ExprRangeFull

a .. expression

§

ExprAssign

an assign expression

§

Lit

a literal value

§

ExprClosure

a closure expression

§

Pat

a pattern

§

PatArray

an array pattern

§

PatTuple

a tuple pattern

§

PatObject

an object pattern

§

PatIgnore

an ignore pattern

§

Path

a path

§

PathGenerics

the generics of a path

§

Condition

the let condition of a loop

§

ClosureArguments

closure arguments

§

AnonymousObjectKey

an #{ anonymous object key

§

Attribute

an attribute

§

InnerAttribute

an inner attribute

§

Modifiers

modifiers

§

ModifierSuper

the (super) modifier

§

ModifierSelf

the (self) modifier

§

ModifierCrate

the (crate) modifier

§

ModifierIn

the (in <path>) modifier

§

TokenStream

a raw token stream

§

TemplateString

a raw token stream

Trait Implementations§

Source§

impl Clone for Kind

Source§

fn clone(&self) -> Kind

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 Kind

Source§

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

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

impl Display for Kind

Source§

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

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

impl From<Token> for Kind

Source§

fn from(token: Token) -> Self

Converts to this type from the input type.
Source§

impl Hash for Kind

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

Source§

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

Source§

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

Source§

fn partial_cmp(&self, other: &Kind) -> 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 ToTokens for Kind

Source§

fn to_tokens( &self, context: &mut MacroContext<'_, '_, '_>, stream: &mut TokenStream, ) -> Result<()>

Turn the current item into tokens.
Source§

impl TryClone for Kind

Source§

fn try_clone(&self) -> Result<Self>

Try to clone the current value, raising an allocation error if it’s unsuccessful.
Source§

fn try_clone_from(&mut self, source: &Self) -> Result<(), Error>

Performs copy-assignment from source. Read more
Source§

impl Copy for Kind

Source§

impl Eq for Kind

Source§

impl StructuralPartialEq for Kind

Auto Trait Implementations§

§

impl Freeze for Kind

§

impl RefUnwindSafe for Kind

§

impl Send for Kind

§

impl Sync for Kind

§

impl Unpin for Kind

§

impl UnwindSafe for Kind

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

impl<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
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

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

Source§

type Output = T

Should always be Self
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> ToString for T
where T: Display + ?Sized,

Source§

default fn to_string(&self) -> String

Converts the given value to a String. 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.
Source§

impl<T> TryToOwned for T
where T: TryClone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn try_to_owned(&self) -> Result<T, Error>

Creates owned data from borrowed data, usually by cloning. Read more
Source§

impl<T> TryToString for T
where T: Display,

Source§

fn try_to_string(&self) -> Result<String, Error>

Converts the given value to a String. Read more
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T

Source§

impl<T> RuleType for T
where T: Copy + Debug + Eq + Hash + Ord,