pub struct HashMapContext { /* private fields */ }
Expand description
A context that stores its mappings in hash maps.
Value and function mappings are stored independently, meaning that there can be a function and a value with the same identifier.
This context is type-safe, meaning that an identifier that is assigned a value of some type once cannot be assigned a value of another type.
Implementations§
Trait Implementations§
Source§impl Clone for HashMapContext
impl Clone for HashMapContext
Source§fn clone(&self) -> HashMapContext
fn clone(&self) -> HashMapContext
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Context for HashMapContext
impl Context for HashMapContext
Source§fn get_value(&self, identifier: &str) -> Option<&Value>
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>
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§impl ContextWithMutableFunctions for HashMapContext
impl ContextWithMutableFunctions for HashMapContext
Source§fn set_function(
&mut self,
identifier: String,
function: Function,
) -> EvalexprResult<()>
fn set_function( &mut self, identifier: String, function: Function, ) -> EvalexprResult<()>
Sets the function with the given identifier to the given function.
Source§impl Debug for HashMapContext
impl Debug for HashMapContext
Source§impl Default for HashMapContext
impl Default for HashMapContext
Source§fn default() -> HashMapContext
fn default() -> HashMapContext
Returns the “default value” for a type. Read more
Source§impl<'a> IterateVariablesContext<'a> for HashMapContext
impl<'a> IterateVariablesContext<'a> for HashMapContext
Source§type VariableIterator = Map<Iter<'a, String, Value>, fn((&String, &Value)) -> (String, Value)>
type VariableIterator = Map<Iter<'a, String, Value>, fn((&String, &Value)) -> (String, Value)>
The iterator type for iterating over variable name-value pairs.
Source§type VariableNameIterator = Cloned<Keys<'a, String, Value>>
type VariableNameIterator = Cloned<Keys<'a, String, Value>>
The iterator type for iterating over variable names.
Source§fn iter_variables(&'a self) -> Self::VariableIterator
fn iter_variables(&'a self) -> Self::VariableIterator
Returns an iterator over pairs of variable names and values.
Source§fn iter_variable_names(&'a self) -> Self::VariableNameIterator
fn iter_variable_names(&'a self) -> Self::VariableNameIterator
Returns an iterator over variable names.
Auto Trait Implementations§
impl Freeze for HashMapContext
impl !RefUnwindSafe for HashMapContext
impl Send for HashMapContext
impl Sync for HashMapContext
impl Unpin for HashMapContext
impl !UnwindSafe for HashMapContext
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more