fn instantiate_memories(&mut self, module: &Module, data_initializers: &[DataInitializer]) {
        debug_assert!(self.memories.is_empty());
        // Allocate the underlying memory and initialize it to all zeros.
        self.memories.reserve_exact(module.memories.len());
        for memory in &module.memories {
            let v = LinearMemory::new(memory.pages_count as u32, memory.maximum.map(|m| m as u32));
            self.memories.push(v);
        }
        for init in data_initializers {
            debug_assert!(init.base.is_none(), "globalvar base not supported yet");
            let mem_mut = self.memories[init.memory_index].as_mut();
            let to_init = &mut mem_mut[init.offset..init.offset + init.data.len()];
            to_init.copy_from_slice(init.data);
        }
    }
/// Allocate memory in `instance` for just the memories of the current module.
Allocate memory in `instance` for just the memories of the current module.
Allocate memory in ` instance ` for just the memories of the current module .
fn instantiate_memories(&mut self, module: &Module, data_initializers: &[DataInitializer]) {
        debug_assert!(self.memories.is_empty());
        // Allocate the underlying memory and initialize it to all zeros.
        self.memories.reserve_exact(module.memories.len());
        for memory in &module.memories {
            let v = LinearMemory::new(memory.pages_count as u32, memory.maximum.map(|m| m as u32));
            self.memories.push(v);
        }
        for init in data_initializers {
            debug_assert!(init.base.is_none(), "globalvar base not supported yet");
            let mem_mut = self.memories[init.memory_index].as_mut();
            let to_init = &mut mem_mut[init.offset..init.offset + init.data.len()];
            to_init.copy_from_slice(init.data);
        }
    }
fn instantiate_memories ( & mut self , module : & Module , data_initializers : & [ DataInitializer ] ) { debug_assert ! ( self memories is_empty ( ) ) ; // Allocate the underlying memory and initialize it to all zeros. self . memories . reserve_exact ( module . memories . len ( ) ) ; for memory in & module . memories { let v = LinearMemory :: new ( memory . pages_count as u32 , memory . maximum . map ( | m | m as u32 ) ) ; self . memories . push ( v ) ; } for init in data_initializers { debug_assert ! ( init base is_none ( ) " " ) ; let mem_mut = self . memories [ init . memory_index ] . as_mut ( ) ; let to_init = & mut mem_mut [ init . offset .. init . offset + init . data . len ( ) ] ; to_init . copy_from_slice ( init . data ) ; } }
Allocate memory in `instance` for just the memories of the current module.
Allocate memory in ` instance ` for just the memories of the current module .
&mut self
module
&Module
data_initializers
&[DataInitializer]
&mut self
module
&Module
data_initializers
&[DataInitializer]