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> Freeze for Globals<'a>
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