pub trait Environment: Send + Sync {
// Required methods
fn define_env(
&mut self,
key: &str,
value: ScriptingValue,
) -> Result<(), Error>;
fn get_env(&self, key: &str) -> Result<ScriptingValue, Error>;
fn set_env(&mut self, key: &str, value: ScriptingValue) -> Result<(), Error>;
}Expand description
The trait for providing an Environment to a VM
that stores variables persistently and externally available.
Required Methods§
Sourcefn define_env(&mut self, key: &str, value: ScriptingValue) -> Result<(), Error>
fn define_env(&mut self, key: &str, value: ScriptingValue) -> Result<(), Error>
Define the variable with key to value.
It has to be created if it does not already exist.
§Errors
if the Variable exists with a different type