pub trait OpHandler {
// Required methods
fn eval_binary_op(
&mut self,
context: &mut Context,
left: JsonnetValue,
op: BinaryOp,
right: JsonnetValue,
) -> Result<JsonnetValue>;
fn eval_unary_op(
&mut self,
context: &mut Context,
op: UnaryOp,
operand: JsonnetValue,
) -> Result<JsonnetValue>;
}
Expand description
Handler for binary and unary operations
Required Methods§
Sourcefn eval_binary_op(
&mut self,
context: &mut Context,
left: JsonnetValue,
op: BinaryOp,
right: JsonnetValue,
) -> Result<JsonnetValue>
fn eval_binary_op( &mut self, context: &mut Context, left: JsonnetValue, op: BinaryOp, right: JsonnetValue, ) -> Result<JsonnetValue>
Evaluate a binary operation (e.g., 2 + 3, “hello” + “world”)
Sourcefn eval_unary_op(
&mut self,
context: &mut Context,
op: UnaryOp,
operand: JsonnetValue,
) -> Result<JsonnetValue>
fn eval_unary_op( &mut self, context: &mut Context, op: UnaryOp, operand: JsonnetValue, ) -> Result<JsonnetValue>
Evaluate a unary operation (e.g., -5, !true)