pub struct Context { /* private fields */ }Expand description
Execution context with scope management
Implementations§
Source§impl Context
impl Context
Sourcepub fn push_scope(&mut self)
pub fn push_scope(&mut self)
Push a new scope onto the stack
Sourcepub fn set_variable(&mut self, name: String, value: Value)
pub fn set_variable(&mut self, name: String, value: Value)
Set a variable in the current scope
Sourcepub fn get_variable(&self, name: &str) -> Option<Value>
pub fn get_variable(&self, name: &str) -> Option<Value>
Get a variable value (searches from current scope up to global)
Sourcepub fn define_function(
&mut self,
name: String,
params: Vec<String>,
body: Vec<Statement>,
)
pub fn define_function( &mut self, name: String, params: Vec<String>, body: Vec<Statement>, )
Define a function
Sourcepub fn get_function(&self, name: &str) -> Option<&FunctionDef>
pub fn get_function(&self, name: &str) -> Option<&FunctionDef>
Get a function definition
Sourcepub fn has_variable(&self, name: &str) -> bool
pub fn has_variable(&self, name: &str) -> bool
Check if a variable exists
Sourcepub fn has_function(&self, name: &str) -> bool
pub fn has_function(&self, name: &str) -> bool
Check if a function exists
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Context
impl RefUnwindSafe for Context
impl Send for Context
impl Sync for Context
impl Unpin for Context
impl UnwindSafe for Context
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