Enum jrsonnet_parser::Expr [−][src]
pub enum Expr {
Show variants
Literal(LiteralType),
Str(IStr),
Num(f64),
Var(IStr),
Arr(Vec<LocExpr>),
ArrComp(LocExpr, Vec<CompSpec>),
Obj(ObjBody),
ObjExtend(LocExpr, ObjBody),
Parened(LocExpr),
UnaryOp(UnaryOpType, LocExpr),
BinaryOp(LocExpr, BinaryOpType, LocExpr),
AssertExpr(AssertStmt, LocExpr),
LocalExpr(Vec<BindSpec>, LocExpr),
Import(PathBuf),
ImportStr(PathBuf),
ErrorStmt(LocExpr),
Apply(LocExpr, ArgsDesc, bool),
Index(LocExpr, LocExpr),
Function(ParamsDesc, LocExpr),
Intrinsic(IStr),
IfElse {
cond: IfSpecData,
cond_then: LocExpr,
cond_else: Option<LocExpr>,
},
}Expand description
Syntax base
Variants
Literal(LiteralType)Str(IStr)String value: “hello”
Num(f64)Number: 1, 2.0, 2e+20
Var(IStr)Variable name: test
Array of expressions: [1, 2, “Hello”]
Array comprehension:
ingredients: [
{ kind: kind, qty: 4 / 3 }
for kind in [
'Honey Syrup',
'Lemon Juice',
'Farmers Gin',
]
],
Obj(ObjBody)Object: {a: 2}
Object extension: var1 {b: 2}
Parened(LocExpr)(obj)
UnaryOp(UnaryOpType, LocExpr)-2
BinaryOp(LocExpr, BinaryOpType, LocExpr)2 - 2
AssertExpr(AssertStmt, LocExpr)assert 2 == 2 : “Math is broken”
local a = 2; { b: a }
Import(PathBuf)import “hello”
ImportStr(PathBuf)importStr “file.txt”
ErrorStmt(LocExpr)error “I’m broken”
a(b, c)
a[b]
Function(ParamsDesc, LocExpr)function(x) x
Intrinsic(IStr)std.primitiveEquals
if true == false then 1 else 2
Show fields
Fields of IfElse
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Exprimpl !UnwindSafe for Expr