pub enum Expression {
    Identifier(Identifier),
    Integer(IntegerLiteral),
    Float(FloatLiteral),
    Boolean(BooleanLiteral),
    String(StringLiteral),
    Unary {
        op: UnaryOperator,
        right: Box<Expression>,
    },
    Binary {
        left: Box<Expression>,
        op: BinaryOperator,
        right: Box<Expression>,
    },
    FunctionCall {
        left: Box<Expression>,
        args: Vec<Expression>,
    },
    Index {
        left: Box<Expression>,
        index: Box<Expression>,
    },
}
Expand description

Expression in a statement

Variants

Identifier(Identifier)

Identifier as an expression

Integer(IntegerLiteral)

Integer literal

Float(FloatLiteral)

Float literal

Boolean(BooleanLiteral)

Boolean literal

String(StringLiteral)

String literal

Unary

Fields

op: UnaryOperator

Unary operator

right: Box<Expression>

Child expression

Unary prefix operator expressions

Binary

Fields

left: Box<Expression>

Left child expression

op: BinaryOperator

Binary operator

right: Box<Expression>

Right child expression

Binary operator expressions

FunctionCall

Fields

left: Box<Expression>

Callable expression (usually an identifier)

args: Vec<Expression>

List of expressions

Call a function with an argument list

Index

Fields

left: Box<Expression>

Container (i.e. arrays and hashmaps) to index

index: Box<Expression>

Index

Retrieve an element from a container

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.