pub struct Environment { /* private fields */ }Expand description
Environment for storing variables
Implementations§
Source§impl Environment
impl Environment
Sourcepub fn with_parent(parent: Rc<RefCell<Environment>>) -> Self
pub fn with_parent(parent: Rc<RefCell<Environment>>) -> Self
Create a new environment with a parent
Sourcepub fn get(&self, name: &str) -> Option<Value>
pub fn get(&self, name: &str) -> Option<Value>
Get a variable from this scope or parent scopes (优化路径)
Sourcepub fn has(&self, name: &str) -> bool
pub fn has(&self, name: &str) -> bool
Check if a variable exists in this scope or parent scopes
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 !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