pub struct StaticEnvironment { /* private fields */ }Expand description
Stack of local variables in nested scopes
Each scope represents a Ruby scope:
# 1
class A
# 1, 2
def m
# 1, 2, 3
end
# 1, 2
end
# 1In the example above comments show what’s in the stack. Basically, it’s pushed when you enter a new scope and it’s popped when exit it.
Implementations§
Source§impl StaticEnvironment
impl StaticEnvironment
Sourcepub fn extend_static(&self)
pub fn extend_static(&self)
Performs a push, doesn’t inherit previously declared variables in the new scope
Handles class/module scopes
Sourcepub fn extend_dynamic(&self)
pub fn extend_dynamic(&self)
Performs a push, inherits previously declared variables in the new scope
Handles block/lambda scopes
Sourcepub fn is_declared(&self, name: &str) -> bool
pub fn is_declared(&self, name: &str) -> bool
Returns true if variable with a given name is declared in the current scope
Trait Implementations§
Source§impl Clone for StaticEnvironment
impl Clone for StaticEnvironment
Source§impl Debug for StaticEnvironment
impl Debug for StaticEnvironment
Auto Trait Implementations§
impl !RefUnwindSafe for StaticEnvironment
impl !Send for StaticEnvironment
impl !Sync for StaticEnvironment
impl !UnwindSafe for StaticEnvironment
impl Freeze for StaticEnvironment
impl Unpin for StaticEnvironment
impl UnsafeUnpin for StaticEnvironment
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