Struct sindra::scope::Scope
[−]
[src]
pub struct Scope<T> { pub item: T, pub parent: Option<Rc<RefCell<Scope<T>>>>, }
General scope object with underlying data structure T
.
Scoping is handled by a linked list of Scope
objects from the child Scope
object (which is
the parent of no other scope) to the root (global) Scope
object, which has no parent.
Fields
item: T
Underlying scoped data structure.
parent: Option<Rc<RefCell<Scope<T>>>>
Optional pointer to the parent of this scope.
This should be Some(...)
for every Scope
object except the root node.
This is maintained as an Rc<RefCell<...>>
since a single scope can be the parent of
multiple other scopes.
Trait Implementations
impl<Sym: Clone, Tbl> SymbolStore<Sym> for Scope<Tbl> where
Tbl: SymbolTable<Sym>,
[src]
Tbl: SymbolTable<Sym>,
fn define(&mut self, ident: Identifier, symbol: Sym) -> Option<Sym>
[src]
Defines (or updates) a symbol in this symbol store. Returns previous symbol if this identifier has been previously declared. Read more
fn resolve(&self, ident: &Identifier) -> Option<Sym>
[src]
Resolves a symbol in this symbol store, or None
if no symbol exists for the identifier.
impl<Val: Clone, T> MemoryStore<Val> for Scope<T> where
T: MemoryTable<Val>,
[src]
T: MemoryTable<Val>,
fn set(&mut self, ident: Identifier, value: Val) -> Result<Option<Val>, String>
[src]
Sets (or updates) the value in memory for an identifier. Returns the previous value (if exists). Typically, the identifier should already exist in the store, but may not have an existing value. Read more
fn get(&self, ident: &Identifier) -> Option<Val>
[src]
Retrieves the value for a particular identifier, if exists.
impl<T: Debug> Debug for Scope<T>
[src]
impl<T: Clone> Clone for Scope<T>
[src]
fn clone(&self) -> Scope<T>
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<T: PartialEq> PartialEq for Scope<T>
[src]
fn eq(&self, __arg_0: &Scope<T>) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Scope<T>) -> bool
[src]
This method tests for !=
.