Trait evalexpr::Context

source ·
pub trait Context {
    // Required methods
    fn get_value(&self, identifier: &str) -> Option<&Value>;
    fn call_function(
        &self,
        identifier: &str,
        argument: &Value
    ) -> EvalexprResult<Value>;
    fn are_builtin_functions_disabled(&self) -> bool;
    fn set_builtin_functions_disabled(
        &mut self,
        disabled: bool
    ) -> EvalexprResult<()>;
}
Expand description

An immutable context.

Required Methods§

source

fn get_value(&self, identifier: &str) -> Option<&Value>

Returns the value that is linked to the given identifier.

source

fn call_function( &self, identifier: &str, argument: &Value ) -> EvalexprResult<Value>

Calls the function that is linked to the given identifier with the given argument. If no function with the given identifier is found, this method returns EvalexprError::FunctionIdentifierNotFound.

source

fn are_builtin_functions_disabled(&self) -> bool

Checks if builtin functions are disabled.

source

fn set_builtin_functions_disabled( &mut self, disabled: bool ) -> EvalexprResult<()>

Disables builtin functions if disabled is true, and enables them otherwise. If the context does not support enabling or disabling builtin functions, an error is returned.

Implementors§