Expand description
§Variable Manager
Provides concrete implementation of variable management for the VM executor.
Manages local and global variable storage and implements the VariableManager
trait for variable access and manipulation.
§Overview
The variable manager provides a simple array-based storage system for both local and global variables, supporting:
- Local Variables: Function-scoped variables with limited lifetime
- Global Variables: Program-wide variables accessible across functions
- Variable Access: Getting and setting variables by index
- Mutable Access: Direct access to variable storage for advanced operations
§Storage Model
Variables are stored in fixed-size vectors, with each variable slot
identified by a numeric index. Undefined variables are represented
as Value::Undefined.
§Usage
use jetcrab::vm::executor::variable_manager::VariableManagerImpl;
use jetcrab::vm::executor::traits::VariableManager;
use jetcrab::vm::value::Value;
let mut var_manager = VariableManagerImpl::new();
var_manager.set_local(0, Value::Number(42.0));
let value = var_manager.get_local(0);Structs§
- Variable
Manager Impl - Concrete implementation of variable management for the VM