pub struct StaticEnvironment { /* private fields */ }Expand description
An Environment implementation in which all variables and functions are
known ahead of execution. All variable and function names treated as case-insensitive.
Implementations§
Source§impl StaticEnvironment
impl StaticEnvironment
Sourcepub fn add_variable(&mut self, name: &str, value: Value)
pub fn add_variable(&mut self, name: &str, value: Value)
Adds or updates a single variable.
Sourcepub fn remove_variable(&mut self, name: &str) -> Option<Rc<Value>>
pub fn remove_variable(&mut self, name: &str) -> Option<Rc<Value>>
Removes a variable and return its Rc<Value> if it existed.
Sourcepub fn clear_variables(&mut self)
pub fn clear_variables(&mut self)
Clears all variables.
Sourcepub fn add_function(&mut self, func: Function)
pub fn add_function(&mut self, func: Function)
Adds or updates a NativeFunction.
Sourcepub fn add_functions(&mut self, functions: Vec<Function>)
pub fn add_functions(&mut self, functions: Vec<Function>)
Calls add_function for a Vec<Function>.
Sourcepub fn remove_function(&mut self, name: &str) -> Option<Rc<Function>>
pub fn remove_function(&mut self, name: &str) -> Option<Rc<Function>>
Removes a NativeFunction and return
its Function if it existed.
Trait Implementations§
Source§impl Default for StaticEnvironment
impl Default for StaticEnvironment
Source§fn default() -> StaticEnvironment
fn default() -> StaticEnvironment
Returns the “default value” for a type. Read more
Source§impl Environment for StaticEnvironment
impl Environment for StaticEnvironment
Source§fn variable(&self, name: &str) -> Option<Rc<Value>>
fn variable(&self, name: &str) -> Option<Rc<Value>>
Get a variable
Value from the Environment.Source§fn variable_exists(&self, name: &str) -> bool
fn variable_exists(&self, name: &str) -> bool
Checks if a variable with a matching name exists.
Source§fn function_exists(&self, name: &str, param_count: usize) -> FunctionResult
fn function_exists(&self, name: &str, param_count: usize) -> FunctionResult
Checks if a function with a matching name and compatible arity exists.
Auto Trait Implementations§
impl Freeze for StaticEnvironment
impl RefUnwindSafe for StaticEnvironment
impl !Send for StaticEnvironment
impl !Sync for StaticEnvironment
impl Unpin for StaticEnvironment
impl UnwindSafe for StaticEnvironment
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