pub struct VariableTable { /* private fields */ }Expand description
Variable table with hierarchical scoping
Implementations§
Source§impl VariableTable
impl VariableTable
Sourcepub fn with_parent(parent: VariableTable) -> Self
pub fn with_parent(parent: VariableTable) -> Self
Create new variable table with parent scope
Sourcepub fn set_with_type(
&mut self,
name: String,
value: Value,
binding_type: BindingType,
)
pub fn set_with_type( &mut self, name: String, value: Value, binding_type: BindingType, )
Set variable with specific binding type
Sourcepub fn update(&mut self, name: &str, value: Value) -> Result<(), String>
pub fn update(&mut self, name: &str, value: Value) -> Result<(), String>
Update existing variable (respecting const)
Sourcepub fn get(&self, name: &str) -> Option<&Value>
pub fn get(&self, name: &str) -> Option<&Value>
Get variable value (searches up the scope chain)
Sourcepub fn get_binding(&self, name: &str) -> Option<&Binding>
pub fn get_binding(&self, name: &str) -> Option<&Binding>
Get binding (with metadata)
Sourcepub fn has_local(&self, name: &str) -> bool
pub fn has_local(&self, name: &str) -> bool
Check if variable exists in current scope (not parent)
Sourcepub fn local_variables(&self) -> Vec<String>
pub fn local_variables(&self) -> Vec<String>
Get all variables in current scope (for debugging)
Trait Implementations§
Source§impl Clone for VariableTable
impl Clone for VariableTable
Source§fn clone(&self) -> VariableTable
fn clone(&self) -> VariableTable
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for VariableTable
impl Debug for VariableTable
Source§impl Default for VariableTable
impl Default for VariableTable
Source§impl PartialEq for VariableTable
impl PartialEq for VariableTable
impl StructuralPartialEq for VariableTable
Auto Trait Implementations§
impl Freeze for VariableTable
impl RefUnwindSafe for VariableTable
impl Send for VariableTable
impl Sync for VariableTable
impl Unpin for VariableTable
impl UnwindSafe for VariableTable
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
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>
Converts
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>
Converts
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