pub struct SymbolTable { /* private fields */ }Expand description
Context for storing and managing variables during query execution with scope support
Implementations§
Source§impl SymbolTable
impl SymbolTable
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) Searches from innermost to outermost scope to find the variable
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)
Sourcepub fn define_function(&mut self, name: String, func: CompiledFunctionDef)
pub fn define_function(&mut self, name: String, func: CompiledFunctionDef)
Define a user-defined function (pre-compiled)
Sourcepub fn get_function(&self, name: &str) -> Option<&CompiledFunctionDef>
pub fn get_function(&self, name: &str) -> Option<&CompiledFunctionDef>
Get a user-defined function by name
Sourcepub fn function_exists(&self, name: &str) -> bool
pub fn function_exists(&self, name: &str) -> bool
Check if a function exists
Trait Implementations§
Source§impl Clone for SymbolTable
impl Clone for SymbolTable
Source§fn clone(&self) -> SymbolTable
fn clone(&self) -> SymbolTable
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SymbolTable
impl Debug for SymbolTable
Auto Trait Implementations§
impl Freeze for SymbolTable
impl RefUnwindSafe for SymbolTable
impl Send for SymbolTable
impl Sync for SymbolTable
impl Unpin for SymbolTable
impl UnsafeUnpin for SymbolTable
impl UnwindSafe for SymbolTable
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more