Trait Environment

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

Source

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

Source

fn get_env(&self, key: &str) -> Result<ScriptingValue, Error>

Get a variable by key

§Errors

if the variable does not exist

Source

fn set_env(&mut self, key: &str, value: ScriptingValue) -> Result<(), Error>

Set the variable with key to value.

§Errors

if variable does not exist.

Implementors§