Struct gitql_ast::environment::Environment
source · pub struct Environment {
pub globals: HashMap<String, Value>,
pub globals_types: HashMap<String, DataType>,
pub scopes: HashMap<String, DataType>,
}
Fields§
§globals: HashMap<String, Value>
All Global Variables values that can life for this program session
globals_types: HashMap<String, DataType>
All Global Variables Types that can life for this program session
scopes: HashMap<String, DataType>
Local variables types in the current scope, later will be multi layer scopes
Implementations§
source§impl Environment
impl Environment
sourcepub fn define_global(&mut self, str: String, data_type: DataType)
pub fn define_global(&mut self, str: String, data_type: DataType)
Define in the global scope
sourcepub fn contains(&self, str: &String) -> bool
pub fn contains(&self, str: &String) -> bool
Returns true if local or global scopes has contains field
sourcepub fn resolve_type(&self, str: &String) -> Option<&DataType>
pub fn resolve_type(&self, str: &String) -> Option<&DataType>
Resolve Global or Local type using symbol name
sourcepub fn clear_session(&mut self)
pub fn clear_session(&mut self)
Clear all locals scopes and only save globals
Trait Implementations§
source§impl Default for Environment
impl Default for Environment
source§fn default() -> Environment
fn default() -> Environment
Returns the “default value” for a type. Read more
Auto Trait Implementations§
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