Struct tree_sitter_graph::Variables
source · pub struct Variables<'a> { /* private fields */ }Expand description
Environment of immutable variables
Implementations§
source§impl<'a> Globals<'a>
impl<'a> Globals<'a>
sourcepub fn nested(context: &'a Globals<'a>) -> Self
pub fn nested(context: &'a Globals<'a>) -> Self
Creates a nested variable environment, that inherits from the given context environment.
sourcepub fn add(
&mut self,
name: Identifier,
value: Value
) -> Result<(), VariableError>
pub fn add( &mut self, name: Identifier, value: Value ) -> Result<(), VariableError>
Adds a new variable to this environment, returning an error if the variable already exists.
sourcepub fn get(&self, name: &Identifier) -> Option<&Value>
pub fn get(&self, name: &Identifier) -> Option<&Value>
Returns the value of a variable, if it exists in this environment.
sourcepub fn remove(&mut self, name: &Identifier)
pub fn remove(&mut self, name: &Identifier)
Remove a variable from this enviroment, if it exists.