cl_ast::ast

Enum ExprKind

Source
pub enum ExprKind {
Show 26 variants Empty, Quote(Quote), Let(Let), Match(Match), Assign(Assign), Modify(Modify), Binary(Binary), Unary(Unary), Cast(Cast), Member(Member), Index(Index), Structor(Structor), Path(Path), Literal(Literal), Array(Array), ArrayRep(ArrayRep), AddrOf(AddrOf), Block(Block), Group(Group), Tuple(Tuple), While(While), If(If), For(For), Break(Break), Return(Return), Continue,
}
Expand description

Any of the different Expressions

Variants§

§

Empty

An empty expression: ( )

§

Quote(Quote)

A backtick-quoted expression

§

Let(Let)

A local bind instruction, let Sym = Expr

§

Match(Match)

A Match expression: match Expr { (MatchArm ,)* MatchArm? }

§

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

§

Cast(Cast)

A Cast expression: Expr as Ty

§

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)+ )

§

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

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<Cast>> for ExprKind

Source§

fn from(value: Box<Cast>) -> 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<Let>> for ExprKind

Source§

fn from(value: Box<Let>) -> 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<Match>> for ExprKind

Source§

fn from(value: Box<Match>) -> 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<Quote>> for ExprKind

Source§

fn from(value: Box<Quote>) -> 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<Cast> for ExprKind

Source§

fn from(value: Cast) -> 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<Let> for ExprKind

Source§

fn from(value: Let) -> 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<Match> for ExprKind

Source§

fn from(value: Match) -> 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<Quote> for ExprKind

Source§

fn from(value: Quote) -> 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

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 TryFrom<ExprKind> for Pattern

Source§

fn try_from(value: ExprKind) -> Result<Self, Self::Error>

Performs the conversion. On failure, returns the first non-pattern subexpression.

Source§

type Error = ExprKind

The type returned in the event of a conversion error.
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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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> ToString for T
where T: Display + ?Sized,

Source§

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.