pub fn save_memory(
        &mut self,
        label: MemoryLabel,
        partial_inst: PartialStructInstantiation,
        global_state: &GlobalState,
    ) {
        let mut per_struct_map = BTreeMap::new();
        for (addr, state) in &global_state.accounts {
            for (inst, val) in &state.storage {
                if inst.ident == partial_inst.ident {
                    per_struct_map
                        .entry(inst.clone())
                        .or_insert_with(BTreeMap::new)
                        .insert(*addr, val.clone());
                }
            }
        }
        self.saved_memory
            .entry(label)
            .and_modify(|per_label_map| per_label_map.clear())
            .or_insert_with(BTreeMap::new)
            .insert(partial_inst.ident, per_struct_map);
    }
/// Collect resources of the (partial) instantiation type from the global state and save them
/// under the given memory label
Collect resources of the (partial) instantiation type from the global state and save them
under the given memory label
Collect resources of the ( partial ) instantiation type from the global state and save them under the given memory label
pub fn save_memory(
        &mut self,
        label: MemoryLabel,
        partial_inst: PartialStructInstantiation,
        global_state: &GlobalState,
    ) {
        let mut per_struct_map = BTreeMap::new();
        for (addr, state) in &global_state.accounts {
            for (inst, val) in &state.storage {
                if inst.ident == partial_inst.ident {
                    per_struct_map
                        .entry(inst.clone())
                        .or_insert_with(BTreeMap::new)
                        .insert(*addr, val.clone());
                }
            }
        }
        self.saved_memory
            .entry(label)
            .and_modify(|per_label_map| per_label_map.clear())
            .or_insert_with(BTreeMap::new)
            .insert(partial_inst.ident, per_struct_map);
    }
pub fn save_memory ( & mut self , label : MemoryLabel , partial_inst : PartialStructInstantiation , global_state : & GlobalState , ) { let mut per_struct_map = BTreeMap :: new ( ) ; for ( addr , state ) in & global_state . accounts { for ( inst , val ) in & state . storage { if inst . ident == partial_inst . ident { per_struct_map . entry ( inst . clone ( ) ) . or_insert_with ( BTreeMap :: new ) . insert ( * addr , val . clone ( ) ) ; } } } self . saved_memory . entry ( label ) . and_modify ( | per_label_map | per_label_map . clear ( ) ) . or_insert_with ( BTreeMap :: new ) . insert ( partial_inst . ident , per_struct_map ) ; }
Collect resources of the (partial) instantiation type from the global state and save them
under the given memory label
Collect resources of the ( partial ) instantiation type from the global state and save them under the given memory label
&mut self
label
MemoryLabel
partial_inst
PartialStructInstantiation
global_state
&GlobalState