pub struct Environment { /* private fields */ }Expand description
Variable environment for scoping
Implementations§
Source§impl Environment
impl Environment
Sourcepub fn with_parent(parent: Environment) -> Self
pub fn with_parent(parent: Environment) -> Self
Creates a new child environment
Sourcepub fn lookup(&self, name: &str) -> Result<&Value>
pub fn lookup(&self, name: &str) -> Result<&Value>
Looks up a variable in this scope or parent scopes
Sourcepub fn is_defined(&self, name: &str) -> bool
pub fn is_defined(&self, name: &str) -> bool
Checks if a variable is defined
Sourcepub fn update(&mut self, name: &str, value: Value) -> Result<()>
pub fn update(&mut self, name: &str, value: Value) -> Result<()>
Updates a variable in the current scope or parent scopes
Sourcepub fn merge(&mut self, other: Environment)
pub fn merge(&mut self, other: Environment)
Merges another environment into this one
Trait Implementations§
Source§impl Clone for Environment
impl Clone for Environment
Source§fn clone(&self) -> Environment
fn clone(&self) -> Environment
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 Environment
impl Debug for Environment
Auto Trait Implementations§
impl Freeze for Environment
impl RefUnwindSafe for Environment
impl Send for Environment
impl Sync for Environment
impl Unpin for Environment
impl UnsafeUnpin for Environment
impl UnwindSafe for Environment
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