From e4ea5b081b1616246e953fcff7493d126cb64fdd Mon Sep 17 00:00:00 2001 From: Magnus Ulimoen Date: Tue, 6 Jul 2021 22:10:33 +0200 Subject: [PATCH] Update evalexpr dependency --- multigrid/Cargo.toml | 2 +- multigrid/src/eval/evalexpr.rs | 64 ---------------------------------- 2 files changed, 1 insertion(+), 65 deletions(-) diff --git a/multigrid/Cargo.toml b/multigrid/Cargo.toml index 69dcd5e..91490c4 100644 --- a/multigrid/Cargo.toml +++ b/multigrid/Cargo.toml @@ -17,4 +17,4 @@ serde = { version = "1.0.115", features = ["derive"] } json5 = "0.3.0" indexmap = { version = "1.5.2", features = ["serde-1"] } argh = "0.1.4" -evalexpr = "6.2.0" +evalexpr = "6.3.0" diff --git a/multigrid/src/eval/evalexpr.rs b/multigrid/src/eval/evalexpr.rs index a0511e5..e999252 100644 --- a/multigrid/src/eval/evalexpr.rs +++ b/multigrid/src/eval/evalexpr.rs @@ -359,69 +359,5 @@ pub fn default_context() -> HashMapContext { ) .unwrap(); - context - .set_function( - "math::atan2".into(), - Function::new(|arg| { - let arg = arg.as_tuple()?; - if arg.len() != 2 { - return Err(error::EvalexprError::WrongFunctionArgumentAmount { - expected: 2, - actual: arg.len(), - }); - } - let s = arg[0].as_number()?; - let o = arg[1].as_number()?; - Ok(s.atan2(o).into()) - }), - ) - .unwrap(); - - context - .set_function( - "math::hypot".into(), - Function::new(|arg| { - let arg = arg.as_tuple()?; - if arg.len() != 2 { - return Err(error::EvalexprError::WrongFunctionArgumentAmount { - expected: 2, - actual: arg.len(), - }); - } - let s = arg[0].as_number()?; - let o = arg[1].as_number()?; - Ok(s.hypot(o).into()) - }), - ) - .unwrap(); - - context - .set_function( - "math::exp".into(), - Function::new(|arg| { - let arg = arg.as_number()?; - Ok(arg.exp().into()) - }), - ) - .unwrap(); - - context - .set_function( - "math::pow".into(), - Function::new(|arg| { - let arg = arg.as_tuple()?; - if arg.len() != 2 { - return Err(error::EvalexprError::WrongFunctionArgumentAmount { - expected: 2, - actual: arg.len(), - }); - } - let s = arg[0].as_number()?; - let o = arg[1].as_number()?; - Ok(s.powf(o).into()) - }), - ) - .unwrap(); - context }