pub enum Expr {
Show 19 variants
Literal(JsonnetValue),
StringInterpolation(Vec<StringInterpolationPart>),
Var(String),
BinaryOp {
left: Box<Expr>,
op: BinaryOp,
right: Box<Expr>,
},
UnaryOp {
op: UnaryOp,
expr: Box<Expr>,
},
Array(Vec<Expr>),
Object(Vec<ObjectField>),
ArrayComp {
expr: Box<Expr>,
var: String,
array: Box<Expr>,
cond: Option<Box<Expr>>,
},
ObjectComp {
field: Box<ObjectField>,
var: String,
array: Box<Expr>,
},
Call {
func: Box<Expr>,
args: Vec<Expr>,
},
Index {
target: Box<Expr>,
index: Box<Expr>,
},
Slice {
target: Box<Expr>,
start: Option<Box<Expr>>,
end: Option<Box<Expr>>,
step: Option<Box<Expr>>,
},
Local {
bindings: Vec<(String, Expr)>,
body: Box<Expr>,
},
Function {
parameters: Vec<String>,
body: Box<Expr>,
},
If {
cond: Box<Expr>,
then_branch: Box<Expr>,
else_branch: Option<Box<Expr>>,
},
Assert {
cond: Box<Expr>,
message: Option<Box<Expr>>,
expr: Box<Expr>,
},
Import(String),
ImportStr(String),
Error(Box<Expr>),
}
Expand description
Expression node in the AST
Variants§
Literal(JsonnetValue)
Literal value (null, boolean, number, string)
StringInterpolation(Vec<StringInterpolationPart>)
String with interpolation
Var(String)
Variable reference
BinaryOp
Binary operation
UnaryOp
Unary operation
Array(Vec<Expr>)
Array literal
Object(Vec<ObjectField>)
Object literal
ArrayComp
Array comprehension
ObjectComp
Object comprehension
Call
Function call
Index
Index access (array[index] or object.field)
Slice
Slice access (array[start:end:step])
Local
Local variable binding
Function
Function definition
If
If-then-else expression
Assert
Assert expression
Import(String)
Import expression
ImportStr(String)
ImportStr expression
Error(Box<Expr>)
Error expression
Trait Implementations§
impl StructuralPartialEq for Expr
Auto Trait Implementations§
impl Freeze for Expr
impl RefUnwindSafe for Expr
impl Send for Expr
impl Sync for Expr
impl Unpin for Expr
impl UnwindSafe for Expr
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more