Struct cairo_vm::types::exec_scope::ExecutionScopes
source · Fields§
§data: Vec<HashMap<String, Box<dyn Any>>>Implementations§
source§impl ExecutionScopes
impl ExecutionScopes
pub fn new() -> ExecutionScopes
pub fn enter_scope(&mut self, new_scope_locals: HashMap<String, Box<dyn Any>>)
pub fn exit_scope(&mut self) -> Result<(), ExecScopeError>
sourcepub fn get_local_variables_mut(
&mut self
) -> Result<&mut HashMap<String, Box<dyn Any>>, HintError>
pub fn get_local_variables_mut(
&mut self
) -> Result<&mut HashMap<String, Box<dyn Any>>, HintError>
Returns a mutable reference to the dictionary containing the variables present in the current scope
sourcepub fn get_local_variables(
&self
) -> Result<&HashMap<String, Box<dyn Any>>, HintError>
pub fn get_local_variables(
&self
) -> Result<&HashMap<String, Box<dyn Any>>, HintError>
Returns a dictionary containing the variables present in the current scope
sourcepub fn delete_variable(&mut self, var_name: &str)
pub fn delete_variable(&mut self, var_name: &str)
Removes a variable from the current scope given its name
sourcepub fn assign_or_update_variable(
&mut self,
var_name: &str,
var_value: Box<dyn Any>
)
pub fn assign_or_update_variable(
&mut self,
var_name: &str,
var_value: Box<dyn Any>
)
Creates or updates an existing variable given its name and boxed value
sourcepub fn get<T: Any + Clone>(&self, name: &str) -> Result<T, HintError>
pub fn get<T: Any + Clone>(&self, name: &str) -> Result<T, HintError>
Returns the value in the current execution scope that matches the name and is of the given generic type
sourcepub fn get_ref<T: Any>(&self, name: &str) -> Result<&T, HintError>
pub fn get_ref<T: Any>(&self, name: &str) -> Result<&T, HintError>
Returns a reference to the value in the current execution scope that matches the name and is of the given generic type
sourcepub fn get_mut_ref<T: Any>(&mut self, name: &str) -> Result<&mut T, HintError>
pub fn get_mut_ref<T: Any>(&mut self, name: &str) -> Result<&mut T, HintError>
Returns a mutable reference to the value in the current execution scope that matches the name and is of the given generic type
sourcepub fn get_any_boxed_ref(&self, name: &str) -> Result<&Box<dyn Any>, HintError>
pub fn get_any_boxed_ref(&self, name: &str) -> Result<&Box<dyn Any>, HintError>
Returns the value in the current execution scope that matches the name
sourcepub fn get_any_boxed_mut(
&mut self,
name: &str
) -> Result<&mut Box<dyn Any>, HintError>
pub fn get_any_boxed_mut(
&mut self,
name: &str
) -> Result<&mut Box<dyn Any>, HintError>
Returns the value in the current execution scope that matches the name
sourcepub fn get_list<T: Any + Clone>(&self, name: &str) -> Result<Vec<T>, HintError>
pub fn get_list<T: Any + Clone>(&self, name: &str) -> Result<Vec<T>, HintError>
Returns the value in the current execution scope that matches the name and is of type List
sourcepub fn get_list_ref<T: Any>(&self, name: &str) -> Result<&Vec<T>, HintError>
pub fn get_list_ref<T: Any>(&self, name: &str) -> Result<&Vec<T>, HintError>
Returns a reference to the value in the current execution scope that matches the name and is of type List
sourcepub fn get_mut_list_ref<T: Any>(
&mut self,
name: &str
) -> Result<&mut Vec<T>, HintError>
pub fn get_mut_list_ref<T: Any>(
&mut self,
name: &str
) -> Result<&mut Vec<T>, HintError>
Returns a mutable reference to the value in the current execution scope that matches the name and is of type List
sourcepub fn get_dict_manager(&self) -> Result<Rc<RefCell<DictManager>>, HintError>
pub fn get_dict_manager(&self) -> Result<Rc<RefCell<DictManager>>, HintError>
Returns the value in the dict manager
sourcepub fn get_mut_dict_ref<K: Any, V: Any>(
&mut self,
name: &str
) -> Result<&mut HashMap<K, V>, HintError>
pub fn get_mut_dict_ref<K: Any, V: Any>(
&mut self,
name: &str
) -> Result<&mut HashMap<K, V>, HintError>
Returns a mutable reference to the value in the current execution scope that matches the name and is of the given type
sourcepub fn insert_box(&mut self, name: &str, value: Box<dyn Any>)
pub fn insert_box(&mut self, name: &str, value: Box<dyn Any>)
Inserts the boxed value into the current scope
sourcepub fn insert_value<T: 'static>(&mut self, name: &str, value: T)
pub fn insert_value<T: 'static>(&mut self, name: &str, value: T)
Inserts the value into the current scope