Add eval_mut function to Operator trait

Relates to #30
This commit is contained in:
Sebastian Schmidt 2019-03-28 08:52:49 +01:00
parent 451a3aa97e
commit 6bd68e6491

View File

@ -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<Value>;
/// Evaluates the operator with the given arguments and mutable context.
fn eval_mut(&self, arguments: &[Value], context: &mut ContextMut) -> EvalexprResult<Value> {
self.eval(arguments, context)
}
}
#[derive(Debug)]