Struct tree_sitter_graph::Variables
source · [−]pub struct Variables<'a>(_);Expand description
Environment of immutable variables
Implementations
sourceimpl<'a> Globals<'a>
impl<'a> Globals<'a>
sourcepub fn nested(context: &'a mut Globals<'a>) -> Self
pub fn nested(context: &'a mut 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.
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more