From 6bd68e649110d04f70be4b7b7d3c5d24220400aa Mon Sep 17 00:00:00 2001 From: Sebastian Schmidt Date: Thu, 28 Mar 2019 08:52:49 +0100 Subject: [PATCH] Add `eval_mut` function to `Operator` trait Relates to #30 --- src/operator/mod.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/operator/mod.rs b/src/operator/mod.rs index d5e8833..1f71c08 100644 --- a/src/operator/mod.rs +++ b/src/operator/mod.rs @@ -1,5 +1,6 @@ use std::fmt::{Debug, Display}; +use ::{ContextMut, ValueType}; use function::builtin::builtin_function; use crate::{context::Context, error::*, value::Value}; @@ -30,6 +31,11 @@ pub trait Operator: Debug + Display { /// Evaluates the operator with the given arguments and context. fn eval(&self, arguments: &[Value], context: &Context) -> EvalexprResult; + + /// Evaluates the operator with the given arguments and mutable context. + fn eval_mut(&self, arguments: &[Value], context: &mut ContextMut) -> EvalexprResult { + self.eval(arguments, context) + } } #[derive(Debug)]