pub trait Locals {
// Required methods
fn open(&mut self, frame: StackFrame);
fn close(&mut self);
fn fetch(&self, id: &Identifier) -> EvalResult<Symbol>;
fn set_local_value(
&mut self,
id: Identifier,
value: Value,
) -> EvalResult<()>;
fn get_local_value(&self, id: &Identifier) -> EvalResult<Value>;
fn get_model(&self) -> EvalResult<Model>;
fn current_name(&self) -> QualifiedName;
}
Expand description
Trait to manage the locals.
The locals manage the state about where evaluation is currently processing the source code.
Items on the local stack can be of different types:
- a source file with an own local stack frame,
- a body (surrounded by curly brackets
{}
), - a module without local variables but aliases (use statements), or
- a call without local variables.
Each one may have different items it stores (see StackFrame
).
Required Methods§
Sourcefn open(&mut self, frame: StackFrame)
fn open(&mut self, frame: StackFrame)
Don’t use this function directly.
Sourcefn fetch(&self, id: &Identifier) -> EvalResult<Symbol>
fn fetch(&self, id: &Identifier) -> EvalResult<Symbol>
Fetch a local variable from current stack frame.
Sourcefn set_local_value(&mut self, id: Identifier, value: Value) -> EvalResult<()>
fn set_local_value(&mut self, id: Identifier, value: Value) -> EvalResult<()>
Set/add a named local value to current locals.
Sourcefn get_local_value(&self, id: &Identifier) -> EvalResult<Value>
fn get_local_value(&self, id: &Identifier) -> EvalResult<Value>
Get a named local value from locals.
Sourcefn get_model(&self) -> EvalResult<Model>
fn get_model(&self) -> EvalResult<Model>
Get a property value from current model.
Sourcefn current_name(&self) -> QualifiedName
fn current_name(&self) -> QualifiedName
Return qualified name of current module or workbench.