Macro shades::lit [−][src]
Create various forms of literal expressions.
This macro allows you to create literal expressions by lifting Rust constants into the EDSL. The way this is done is via several forms:
lit!(x)
lifts a single Rust expression into the EDSL. It’s isomorphic toExpr::from(x)
.lit!(x, y)
lifts two Rust expressions into the EDSL as a 2D scalar vector. It’s isomorphic toExpr::from(V2::from([x, y]))
.lit!(x, y, z)
lifts three Rust expressions into the EDSL as a 3D scalar vector. It’s isomorphic toExpr::from(V3::from([x, y, z]))
.lit!(x, y, z, w)
lifts three Rust expressions into the EDSL as a 3D scalar vector. It’s isomorphic toExpr::from(V4::from([x, y, z, w]))
.
Most of the time, type inference will kick in and you shouldn’t have to annotate the return expression.
Examples
use shades::{lit}; let _ = lit!(1); let _ = lit!(false); let _ = lit!(1., 2., 3., 4.);