Struct shades::var::Var

source · []
pub struct Var<T>(pub Expr<T>) 
where
    T: ?Sized
;
Expand description

Mutable variable.

A Var<T> is akin to an Expr<T> that can be mutated. You can go from a Var<T> to an Expr<T> via either the From or Var::to_expr method.

Variables, because they allow mutations, allow to write more complicated shader functions. Also, lots of graphics pipelines’ properties are variables you will have to write to, such as [VertexShaderEnv::position].

Tuple Fields

0: Expr<T>

Implementations

Coerce Var<T> into Expr<T>.

Remember that doing so will move the Var<T>. clone it if you want to preserve the source variable.

Note: use this function only when necessary. Lots of functions will accept both Expr<T> and Var<T>, performing the coercion for you automatically.

Return

The expression representation of Var<T>, allowing to pass the variable to functions or expressions that don’t easily coerce it automatically to Expr<T> already.

Methods from Deref<Target = Expr<T>>

Equality expression.

This method builds an expression representing the equality between two expressions.

Return

An Expr<bool> representing the equality between the two input expressions.

Inequality expression.

This method builds an expression representing the inequality between two expressions.

Return

An Expr<bool> representing the inequality between the two input expressions.

Less-than expression.

This method builds an expression representing the binary operation a < b.

Return

An Expr<bool> representing a < b.

Less-than-or-equal expression.

This method builds an expression representing the binary operation a <= b.

Return

An Expr<bool> representing a <= b.

Greater-than expression.

This method builds an expression representing the binary operation a > b.

Return

An Expr<bool> representing a > b.

Less-than-or-equal expression.

This method builds an expression representing the binary operation a <= b.

Return

An Expr<bool> representing a <= b.

Logical and expression.

This method builds an expression representing the logical operation a AND b.

Return

An Expr<bool> representing a AND b.

Logical or expression.

This method builds an expression representing the logical operation a OR b.

Return

An Expr<bool> representing a OR b.

Logical exclusive or expression.

This method builds an expression representing the logical operation a XOR b.

Return

An Expr<bool> representing a XOR b.

Array lookup.

The expression a.at(i) represents an array lookup, where a is an array — which type must be either Expr<[T]> or Expr<[T; N]> – and i is an Expr<i32>.

Return

The resulting Expr<T> represents the array lookup in a at index i.

Array lookup.

The expression a.at(i) represents an array lookup, where a is an array — which type must be either Expr<[T]> or Expr<[T; N]> – and i is an Expr<i32>.

Return

The resulting Expr<T> represents the array lookup in a at index i.

4D position of the vertex.

Point size of the vertex.

Clip distances to user-defined planes.

Cull distances to user-defined planes.

Provides 4D the position of the vertex.

Provides the size point of the vertex if it’s currently being rendered in point mode.

Clip distances to user planes of the vertex.

Cull distances to user planes of the vertex.

4D position of the vertex.

Point size of the vertex.

Clip distances to user-defined planes.

Cull distances to user-defined planes.

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

The resulting type after dereferencing.

Dereferences the value.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

The resulting type after applying the - operator.

Performs the unary - operation. Read more

The resulting type after applying the - operator.

Performs the unary - operation. Read more

The resulting type after applying the - operator.

Performs the unary - operation. Read more

The resulting type after applying the - operator.

Performs the unary - operation. Read more

The resulting type after applying the - operator.

Performs the unary - operation. Read more

The resulting type after applying the - operator.

Performs the unary - operation. Read more

The resulting type after applying the - operator.

Performs the unary - operation. Read more

The resulting type after applying the - operator.

Performs the unary - operation. Read more

The resulting type after applying the - operator.

Performs the unary - operation. Read more

The resulting type after applying the - operator.

Performs the unary - operation. Read more

The resulting type after applying the - operator.

Performs the unary - operation. Read more

The resulting type after applying the - operator.

Performs the unary - operation. Read more

The resulting type after applying the ! operator.

Performs the unary ! operation. Read more

The resulting type after applying the ! operator.

Performs the unary ! operation. Read more

The resulting type after applying the ! operator.

Performs the unary ! operation. Read more

The resulting type after applying the ! operator.

Performs the unary ! operation. 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.