Enum glsl::syntax::Expr

source ·
pub enum Expr {
Show 16 variants Variable(Identifier), IntConst(i32), UIntConst(u32), BoolConst(bool), FloatConst(f32), DoubleConst(f64), Unary(UnaryOpBox<Expr>), Binary(BinaryOpBox<Expr>, Box<Expr>), Ternary(Box<Expr>, Box<Expr>, Box<Expr>), Assignment(Box<Expr>, AssignmentOpBox<Expr>), Bracket(Box<Expr>, ArraySpecifier), FunCall(FunIdentifierVec<Expr>), Dot(Box<Expr>, Identifier), PostInc(Box<Expr>), PostDec(Box<Expr>), Comma(Box<Expr>, Box<Expr>),
}
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(Identifier)

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(UnaryOpBox<Expr>)

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

§

Binary(BinaryOpBox<Expr>, Box<Expr>)

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

§

Ternary(Box<Expr>, Box<Expr>, Box<Expr>)

A ternary conditional expression, gathering three expressions.

§

Assignment(Box<Expr>, AssignmentOpBox<Expr>)

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<Expr>, ArraySpecifier)

Add an array specifier to an expression.

§

FunCall(FunIdentifierVec<Expr>)

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

§

Dot(Box<Expr>, Identifier)

An expression associated with a field selection (struct).

§

PostInc(Box<Expr>)

Post-incrementation of an expression.

§

PostDec(Box<Expr>)

Post-decrementation of an expression.

§

Comma(Box<Expr>, Box<Expr>)

An expression that contains several, separated with comma.

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.
Visit an AST node.
Parse from a byte slice.
Parse from a string.
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

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