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.
pub fn is_empty(&self) -> bool
pub fn iter<'b>(&'b self) -> Iter<'b> ⓘ
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for Globals<'a>
impl<'a> !Send for Globals<'a>
impl<'a> !Sync for Globals<'a>
impl<'a> Unpin for Globals<'a>
impl<'a> !UnwindSafe for Globals<'a>
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