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

source

pub fn define(&mut self, str: String, data_type: DataType)

Define in the current scope

source

pub fn define_global(&mut self, str: String, data_type: DataType)

Define in the global scope

source

pub fn contains(&self, str: &String) -> bool

Returns true if local or global scopes has contains field

source

pub fn resolve_type(&self, str: &String) -> Option<&DataType>

Resolve Global or Local type using symbol name

source

pub fn clear_session(&mut self)

Clear all locals scopes and only save globals

Trait Implementations§

source§

impl Default for Environment

source§

fn default() -> Environment

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.