pub struct Scope {
pub parent: Option<Rc<RefCell<Scope>>>,
pub bindings: HashMap<String, JsValue>,
}Expand description
Lexical scope environment frame supporting lexical nesting and closures.
Fields§
§parent: Option<Rc<RefCell<Scope>>>§bindings: HashMap<String, JsValue>Implementations§
Source§impl Scope
impl Scope
pub fn new_root() -> Rc<RefCell<Self>>
pub fn new_child(parent: Rc<RefCell<Self>>) -> Rc<RefCell<Self>>
pub fn get(&self, name: &str) -> Option<JsValue>
pub fn has(&self, name: &str) -> bool
pub fn set(&mut self, name: &str, val: JsValue) -> bool
pub fn declare(&mut self, name: &str, val: JsValue)
Trait Implementations§
impl StructuralPartialEq for Scope
Auto Trait Implementations§
impl !RefUnwindSafe for Scope
impl !Send for Scope
impl !Sync for Scope
impl !UnwindSafe for Scope
impl Forget for Scope
impl Freeze for Scope
impl Move for Scope
impl Unpin for Scope
impl UnsafeUnpin for Scope
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