pub struct Stack { /* private fields */ }Expand description
Context for storing and managing variables during query execution with scope support
Implementations§
Source§impl Stack
impl Stack
Sourcepub fn enter_scope(&mut self, scope_type: ScopeType)
pub fn enter_scope(&mut self, scope_type: ScopeType)
Enter a new scope (push onto stack)
Sourcepub fn exit_scope(&mut self) -> Result<()>
pub fn exit_scope(&mut self) -> Result<()>
Exit the current scope (pop from stack) Returns error if trying to exit the global scope
Sourcepub fn scope_depth(&self) -> usize
pub fn scope_depth(&self) -> usize
Get the current scope depth (0 = global scope)
Sourcepub fn current_scope_type(&self) -> &ScopeType
pub fn current_scope_type(&self) -> &ScopeType
Get the type of the current scope
Sourcepub fn set(
&mut self,
name: String,
variable: Variable,
mutable: bool,
) -> Result<()>
pub fn set( &mut self, name: String, variable: Variable, mutable: bool, ) -> Result<()>
Set a variable in the current (innermost) scope (allows shadowing)
Sourcepub fn reassign(&mut self, name: String, variable: Variable) -> Result<()>
pub fn reassign(&mut self, name: String, variable: Variable) -> Result<()>
Reassign an existing variable (checks mutability)
Sourcepub fn set_in_current_scope(
&mut self,
name: String,
variable: Variable,
mutable: bool,
) -> Result<()>
pub fn set_in_current_scope( &mut self, name: String, variable: Variable, mutable: bool, ) -> Result<()>
Set a variable specifically in the current scope Allows shadowing - new variable declarations can shadow existing ones
Sourcepub fn get(&self, name: &str) -> Option<&Variable>
pub fn get(&self, name: &str) -> Option<&Variable>
Get a variable by searching from innermost to outermost scope
Sourcepub fn get_with_scope(&self, name: &str) -> Option<(&Variable, usize)>
pub fn get_with_scope(&self, name: &str) -> Option<(&Variable, usize)>
Get a variable with its scope depth information
Sourcepub fn exists_in_current_scope(&self, name: &str) -> bool
pub fn exists_in_current_scope(&self, name: &str) -> bool
Check if a variable exists in the current scope only
Sourcepub fn exists_in_any_scope(&self, name: &str) -> bool
pub fn exists_in_any_scope(&self, name: &str) -> bool
Check if a variable exists in any scope (searches all scopes)
Sourcepub fn is_mutable(&self, name: &str) -> bool
pub fn is_mutable(&self, name: &str) -> bool
Check if a variable is mutable (searches from innermost scope)
Sourcepub fn all_variable_names(&self) -> Vec<String>
pub fn all_variable_names(&self) -> Vec<String>
Get all variable names from all scopes (for debugging)
Sourcepub fn visible_variable_names(&self) -> Vec<String>
pub fn visible_variable_names(&self) -> Vec<String>
Get variable names visible in current scope (respects shadowing)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Stack
impl RefUnwindSafe for Stack
impl Send for Stack
impl Sync for Stack
impl Unpin for Stack
impl UnwindSafe for Stack
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)