pub enum ExprData {
Show 16 variants Variable(Node<IdentifierData>), IntConst(i32), UIntConst(u32), BoolConst(bool), FloatConst(f32), DoubleConst(f64), Unary(Node<UnaryOpData>, Box<Node<ExprData>, Global>), Binary(Node<BinaryOpData>, Box<Node<ExprData>, Global>, Box<Node<ExprData>, Global>), Ternary(Box<Node<ExprData>, Global>, Box<Node<ExprData>, Global>, Box<Node<ExprData>, Global>), Assignment(Box<Node<ExprData>, Global>, Node<AssignmentOpData>, Box<Node<ExprData>, Global>), Bracket(Box<Node<ExprData>, Global>, Box<Node<ExprData>, Global>), FunCall(Node<FunIdentifierData>, Vec<Node<ExprData>, Global>), Dot(Box<Node<ExprData>, Global>, Node<IdentifierData>), PostInc(Box<Node<ExprData>, Global>), PostDec(Box<Node<ExprData>, Global>), Comma(Box<Node<ExprData>, Global>, Box<Node<ExprData>, Global>),
}
Expand description

The most general form of an expression.

As you can see if you read the variant list, in GLSL, an assignment is an expression. This is a bit silly but think of an assignment as a statement first then an expression which evaluates to what the statement “returns”.

An expression is either an assignment or a list (comma) of assignments.

Variants

Variable(Node<IdentifierData>)

A variable expression, using an identifier.

IntConst(i32)

Integral constant expression.

UIntConst(u32)

Unsigned integral constant expression.

BoolConst(bool)

Boolean constant expression.

FloatConst(f32)

Single precision floating expression.

DoubleConst(f64)

Double precision floating expression.

Unary(Node<UnaryOpData>, Box<Node<ExprData>, Global>)

A unary expression, gathering a single expression and a unary operator.

Binary(Node<BinaryOpData>, Box<Node<ExprData>, Global>, Box<Node<ExprData>, Global>)

A binary expression, gathering two expressions and a binary operator.

Ternary(Box<Node<ExprData>, Global>, Box<Node<ExprData>, Global>, Box<Node<ExprData>, Global>)

A ternary conditional expression, gathering three expressions.

Assignment(Box<Node<ExprData>, Global>, Node<AssignmentOpData>, Box<Node<ExprData>, Global>)

An assignment is also an expression. Gathers an expression that defines what to assign to, an assignment operator and the value to associate with.

Bracket(Box<Node<ExprData>, Global>, Box<Node<ExprData>, Global>)

Add an array specifier to an expression.

FunCall(Node<FunIdentifierData>, Vec<Node<ExprData>, Global>)

A functional call. It has a function identifier and a list of expressions (arguments).

Dot(Box<Node<ExprData>, Global>, Node<IdentifierData>)

An expression associated with a field selection (struct).

PostInc(Box<Node<ExprData>, Global>)

Post-incrementation of an expression.

PostDec(Box<Node<ExprData>, Global>)

Post-decrementation of an expression.

Comma(Box<Node<ExprData>, Global>, Box<Node<ExprData>, Global>)

An expression that contains several, separated with comma.

Implementations

Construct an Expr::Variable(name) from an identifier name

Try to parse this function identifier as a glsl-lang-quote Rust identifier

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

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Convert the contents into a node

Add span information to a syntax node

Name of the node Read more

Display extra information for the node Read more

Display the node’s children 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.

Name of the syntax node’s type

Starting position of the node

Ending position of the node

Source id of the node

Obtain a display wrapper for the current node

Display extra information for the node Read more

Display the node’s children Read more

The resulting type after obtaining ownership.

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

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.