pub trait FunctionLike:
Evaluate
+ IsConst
+ Debug
+ Send
+ Sync {
// Required methods
fn collapse_inner(&mut self) -> Result<(), MathError>;
fn set_all_variables_shared(&mut self, args: &dyn GetVariable);
fn set_all_variables_owned(&mut self, args: &dyn GetVariable);
fn set_variable_shared(
&mut self,
name: &Variable,
function: &Arc<RootFormula>,
);
fn set_variable_owned(&mut self, name: &Variable, function: &RootFormula);
fn clone_into_box(&self) -> Box<dyn FunctionLike>;
}Expand description
Trait provides base functionality for functions.
Required Methods§
Sourcefn collapse_inner(&mut self) -> Result<(), MathError>
fn collapse_inner(&mut self) -> Result<(), MathError>
Simplifies function arguments. For example if one of the function arguments is “1 + 2”, this method will simplify it to “3”
§Errors
will return Err if got error on evaluation of inner formula
Sets variables present in function to formulas stored in args as shared function.
If function has some inner state and set as shared in different formulas, inner state will be shared.
Sourcefn set_all_variables_owned(&mut self, args: &dyn GetVariable)
fn set_all_variables_owned(&mut self, args: &dyn GetVariable)
Sets variables present in function to formulas stored in args as owned function.
If function has some inner state and set as owned in different formulas, inner state will be different.
Sets variable name in function to function as shared function.
If function has some inner state and set as shared in different formulas, inner state will be shared.
Sourcefn set_variable_owned(&mut self, name: &Variable, function: &RootFormula)
fn set_variable_owned(&mut self, name: &Variable, function: &RootFormula)
Sets variable name in function to function as owned function.
If function has some inner state and set as owned in different formulas, inner state will be different.
Sourcefn clone_into_box(&self) -> Box<dyn FunctionLike>
fn clone_into_box(&self) -> Box<dyn FunctionLike>
Creates clone of object stored in Box as trait object
Trait Implementations§
Source§impl Evaluate for Box<dyn FunctionLike>
impl Evaluate for Box<dyn FunctionLike>
Source§fn eval(&self, args: &dyn GetVariable) -> Result<f64, EvaluationError>
fn eval(&self, args: &dyn GetVariable) -> Result<f64, EvaluationError>
Source§impl FunctionLike for Box<dyn FunctionLike>
impl FunctionLike for Box<dyn FunctionLike>
Source§fn collapse_inner(&mut self) -> Result<(), MathError>
fn collapse_inner(&mut self) -> Result<(), MathError>
args as shared function.
If function has some inner state and set as shared in different formulas, inner state will be shared.Source§fn set_all_variables_owned(&mut self, args: &dyn GetVariable)
fn set_all_variables_owned(&mut self, args: &dyn GetVariable)
args as owned function.
If function has some inner state and set as owned in different formulas, inner state will be different.name in function to function as shared function.
If function has some inner state and set as shared in different formulas, inner state will be shared.Source§fn set_variable_owned(&mut self, name: &Variable, function: &RootFormula)
fn set_variable_owned(&mut self, name: &Variable, function: &RootFormula)
name in function to function as owned function.
If function has some inner state and set as owned in different formulas, inner state will be different.Source§fn clone_into_box(&self) -> Box<dyn FunctionLike>
fn clone_into_box(&self) -> Box<dyn FunctionLike>
Box as trait object