FunctionLike

Trait FunctionLike 

Source
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§

Source

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

Source

fn set_all_variables_shared(&mut self, args: &dyn GetVariable)

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.

Source

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.

Source

fn set_variable_shared(&mut self, name: &Variable, function: &Arc<RootFormula>)

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.

Source

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.

Source

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>

Source§

fn eval(&self, args: &dyn GetVariable) -> Result<f64, EvaluationError>

Evaluates value of formula, args contains variables. Read more
Source§

impl FunctionLike for Box<dyn FunctionLike>

Source§

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” Read more
Source§

fn set_all_variables_shared(&mut self, args: &dyn GetVariable)

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.
Source§

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.
Source§

fn set_variable_shared(&mut self, name: &Variable, function: &Arc<RootFormula>)

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.
Source§

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.
Source§

fn clone_into_box(&self) -> Box<dyn FunctionLike>

Creates clone of object stored in Box as trait object
Source§

impl IsConst for Box<dyn FunctionLike>

Source§

fn is_const(&self) -> bool

Returns true if formula returns same value for every .eval(…) call, else returns false.

Implementations on Foreign Types§

Source§

impl FunctionLike for Box<dyn FunctionLike>

Source§

fn collapse_inner(&mut self) -> Result<(), MathError>

Source§

fn set_all_variables_shared(&mut self, args: &dyn GetVariable)

Source§

fn set_all_variables_owned(&mut self, args: &dyn GetVariable)

Source§

fn set_variable_shared(&mut self, name: &Variable, function: &Arc<RootFormula>)

Source§

fn set_variable_owned(&mut self, name: &Variable, function: &RootFormula)

Source§

fn clone_into_box(&self) -> Box<dyn FunctionLike>

Implementors§