Enum cl_ast::ast::ExprKind

source ·
pub enum ExprKind {
Show 23 variants Empty, Assign(Assign), Modify(Modify), Binary(Binary), Unary(Unary), Member(Member), Index(Index), Structor(Structor), Path(Path), Literal(Literal), Array(Array), ArrayRep(ArrayRep), AddrOf(AddrOf), Block(Block), Group(Group), Tuple(Tuple), Loop(Loop), While(While), If(If), For(For), Break(Break), Return(Return), Continue(Continue),
}
Expand description

Any of the different Expressions

Variants§

§

Empty

An empty expression: ( )

§

Assign(Assign)

An Assignment expression: Expr (= Expr)+

§

Modify(Modify)

A Modify-assignment expression: Expr (ModifyKind Expr)+

§

Binary(Binary)

A Binary expression: Expr (BinaryKind Expr)+

§

Unary(Unary)

A Unary expression: UnaryKind* Expr

§

Member(Member)

A Member access expression: Expr MemberKind*

§

Index(Index)

An Array Index expression: a[10, 20, 30]

§

Structor(Structor)

A Struct creation expression: Path { (Fielder ,)* Fielder? }

§

Path(Path)

§

Literal(Literal)

A Literal: 0x42, 1e123, 2.4, “Hello”

§

Array(Array)

An Array literal: [ Expr (, Expr)* ]

§

ArrayRep(ArrayRep)

An Array literal constructed with repeat syntax [ Expr ; Literal ]

§

AddrOf(AddrOf)

An address-of expression: & mut? Expr

§

Block(Block)

A Block expression: { Stmt* Expr? }

§

Group(Group)

A Grouping expression ( Expr )

§

Tuple(Tuple)

A Tuple expression: ( Expr (, Expr)+ )

§

Loop(Loop)

A Loop expression: loop Block

§

While(While)

A While expression: while Expr Block Else?

§

If(If)

An If expression: if Expr Block Else?

§

For(For)

A For expression: for Pattern in Expr Block Else?

§

Break(Break)

A Break expression: break Expr?

§

Return(Return)

A Return expression return Expr?

§

Continue(Continue)

A continue expression: continue

Trait Implementations§

source§

impl Clone for ExprKind

source§

fn clone(&self) -> ExprKind

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 ExprKind

source§

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

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

impl Default for ExprKind

source§

fn default() -> ExprKind

Returns the “default value” for a type. Read more
source§

impl Display for ExprKind

source§

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

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

impl From<AddrOf> for ExprKind

source§

fn from(value: AddrOf) -> Self

Converts to this type from the input type.
source§

impl From<Array> for ExprKind

source§

fn from(value: Array) -> Self

Converts to this type from the input type.
source§

impl From<ArrayRep> for ExprKind

source§

fn from(value: ArrayRep) -> Self

Converts to this type from the input type.
source§

impl From<Assign> for ExprKind

source§

fn from(value: Assign) -> Self

Converts to this type from the input type.
source§

impl From<Binary> for ExprKind

source§

fn from(value: Binary) -> Self

Converts to this type from the input type.
source§

impl From<Block> for ExprKind

source§

fn from(value: Block) -> Self

Converts to this type from the input type.
source§

impl From<Box<AddrOf>> for ExprKind

source§

fn from(value: Box<AddrOf>) -> Self

Converts to this type from the input type.
source§

impl From<Box<Array>> for ExprKind

source§

fn from(value: Box<Array>) -> Self

Converts to this type from the input type.
source§

impl From<Box<ArrayRep>> for ExprKind

source§

fn from(value: Box<ArrayRep>) -> Self

Converts to this type from the input type.
source§

impl From<Box<Assign>> for ExprKind

source§

fn from(value: Box<Assign>) -> Self

Converts to this type from the input type.
source§

impl From<Box<Binary>> for ExprKind

source§

fn from(value: Box<Binary>) -> Self

Converts to this type from the input type.
source§

impl From<Box<Block>> for ExprKind

source§

fn from(value: Box<Block>) -> Self

Converts to this type from the input type.
source§

impl From<Box<Break>> for ExprKind

source§

fn from(value: Box<Break>) -> Self

Converts to this type from the input type.
source§

impl From<Box<Continue>> for ExprKind

source§

fn from(value: Box<Continue>) -> Self

Converts to this type from the input type.
source§

impl From<Box<For>> for ExprKind

source§

fn from(value: Box<For>) -> Self

Converts to this type from the input type.
source§

impl From<Box<Group>> for ExprKind

source§

fn from(value: Box<Group>) -> Self

Converts to this type from the input type.
source§

impl From<Box<If>> for ExprKind

source§

fn from(value: Box<If>) -> Self

Converts to this type from the input type.
source§

impl From<Box<Index>> for ExprKind

source§

fn from(value: Box<Index>) -> Self

Converts to this type from the input type.
source§

impl From<Box<Literal>> for ExprKind

source§

fn from(value: Box<Literal>) -> Self

Converts to this type from the input type.
source§

impl From<Box<Loop>> for ExprKind

source§

fn from(value: Box<Loop>) -> Self

Converts to this type from the input type.
source§

impl From<Box<Member>> for ExprKind

source§

fn from(value: Box<Member>) -> Self

Converts to this type from the input type.
source§

impl From<Box<Modify>> for ExprKind

source§

fn from(value: Box<Modify>) -> Self

Converts to this type from the input type.
source§

impl From<Box<Path>> for ExprKind

source§

fn from(value: Box<Path>) -> Self

Converts to this type from the input type.
source§

impl From<Box<Return>> for ExprKind

source§

fn from(value: Box<Return>) -> Self

Converts to this type from the input type.
source§

impl From<Box<Tuple>> for ExprKind

source§

fn from(value: Box<Tuple>) -> Self

Converts to this type from the input type.
source§

impl From<Box<Unary>> for ExprKind

source§

fn from(value: Box<Unary>) -> Self

Converts to this type from the input type.
source§

impl From<Box<While>> for ExprKind

source§

fn from(value: Box<While>) -> Self

Converts to this type from the input type.
source§

impl From<Break> for ExprKind

source§

fn from(value: Break) -> Self

Converts to this type from the input type.
source§

impl From<Continue> for ExprKind

source§

fn from(value: Continue) -> Self

Converts to this type from the input type.
source§

impl From<For> for ExprKind

source§

fn from(value: For) -> Self

Converts to this type from the input type.
source§

impl From<Group> for ExprKind

source§

fn from(value: Group) -> Self

Converts to this type from the input type.
source§

impl From<If> for ExprKind

source§

fn from(value: If) -> Self

Converts to this type from the input type.
source§

impl From<Index> for ExprKind

source§

fn from(value: Index) -> Self

Converts to this type from the input type.
source§

impl From<Literal> for ExprKind

source§

fn from(value: Literal) -> Self

Converts to this type from the input type.
source§

impl From<Loop> for ExprKind

source§

fn from(value: Loop) -> Self

Converts to this type from the input type.
source§

impl From<Member> for ExprKind

source§

fn from(value: Member) -> Self

Converts to this type from the input type.
source§

impl From<Modify> for ExprKind

source§

fn from(value: Modify) -> Self

Converts to this type from the input type.
source§

impl From<Path> for ExprKind

source§

fn from(value: Path) -> Self

Converts to this type from the input type.
source§

impl From<Return> for ExprKind

source§

fn from(value: Return) -> Self

Converts to this type from the input type.
source§

impl From<Tuple> for ExprKind

source§

fn from(value: Tuple) -> Self

Converts to this type from the input type.
source§

impl From<Unary> for ExprKind

source§

fn from(value: Unary) -> Self

Converts to this type from the input type.
source§

impl From<While> for ExprKind

source§

fn from(value: While) -> Self

Converts to this type from the input type.
source§

impl Hash for ExprKind

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 ExprKind

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Eq for ExprKind

source§

impl StructuralPartialEq for ExprKind

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, 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,

§

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>,

§

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>,

§

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.