diff options
Diffstat (limited to 'src/math')
| -rw-r--r-- | src/math/context.rs | 8 | ||||
| -rw-r--r-- | src/math/expression_function.rs | 2 |
2 files changed, 9 insertions, 1 deletions
diff --git a/src/math/context.rs b/src/math/context.rs index cb0bca0..e23b96f 100644 --- a/src/math/context.rs +++ b/src/math/context.rs @@ -58,6 +58,14 @@ impl Context { pub fn function(&self, name: &str) -> Option<&Arc<dyn Function>> { self.funcs.get(name) } + + pub fn remove_variable(&mut self, name: &str) { + self.vars.remove(name); + } + + pub fn remove_function(&mut self, name: &str) { + self.funcs.remove(name); + } } #[macro_export] diff --git a/src/math/expression_function.rs b/src/math/expression_function.rs index b9a480f..9debdc4 100644 --- a/src/math/expression_function.rs +++ b/src/math/expression_function.rs @@ -9,7 +9,7 @@ use crate::math::{ function::{Function, FunctionArgument, EmptyFunction} }; -#[derive(Default)] +#[derive(Default, Clone)] pub struct ExpressionFunction { expr: Expression, name: String, |