Struct evalexpr::HashMapContext
source · [−]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
sourceimpl HashMapContext
impl HashMapContext
Trait Implementations
sourceimpl Clone for HashMapContext
impl Clone for HashMapContext
sourcefn clone(&self) -> HashMapContext
fn clone(&self) -> HashMapContext
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Context for HashMapContext
impl Context for HashMapContext
sourcefn 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.
sourcefn 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
. Read more
sourceimpl ContextWithMutableFunctions for HashMapContext
impl ContextWithMutableFunctions for HashMapContext
sourcefn 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.
sourceimpl Debug for HashMapContext
impl Debug for HashMapContext
sourceimpl Default for HashMapContext
impl Default for HashMapContext
sourcefn default() -> HashMapContext
fn default() -> HashMapContext
Returns the “default value” for a type. Read more
Auto Trait Implementations
impl !RefUnwindSafe for HashMapContext
impl Send for HashMapContext
impl Sync for HashMapContext
impl Unpin for HashMapContext
impl !UnwindSafe for HashMapContext
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more