fn initialize(
        &self,
        store: &mut Store,
        module: &wasmtime::Module,
    ) -> anyhow::Result<wasmtime::Instance> {
        log::debug!("Calling the initialization function");

        let mut linker = wasmtime::Linker::new(store.engine());

        if self.allow_wasi {
            wasmtime_wasi::add_to_linker(&mut linker, |ctx: &mut Option<WasiCtx>| {
                ctx.as_mut().unwrap()
            })?;
        }

        dummy_imports(&mut *store, &module, &mut linker)?;

        let instance = linker
            .instantiate(&mut *store, module)
            .context("failed to instantiate the Wasm module")?;

        let init_func = instance
            .get_typed_func::<(), (), _>(&mut *store, &self.init_func)
            .expect("checked by `validate_init_func`");
        init_func
            .call(&mut *store, ())
            .with_context(|| format!("the `{}` function trapped", self.init_func))?;

        Ok(instance)
    }
/// Instantiate the module and call its initialization function.
Instantiate the module and call its initialization function.
Instantiate the module and call its initialization function .
fn initialize(
        &self,
        store: &mut Store,
        module: &wasmtime::Module,
    ) -> anyhow::Result<wasmtime::Instance> {
        log::debug!("Calling the initialization function");
        let mut linker = wasmtime::Linker::new(store.engine());
        if self.allow_wasi {
            wasmtime_wasi::add_to_linker(&mut linker, |ctx: &mut Option<WasiCtx>| {
                ctx.as_mut().unwrap()
            })?;
        }
        dummy_imports(&mut *store, &module, &mut linker)?;
        let instance = linker
            .instantiate(&mut *store, module)
            .context("failed to instantiate the Wasm module")?;
        let init_func = instance
            .get_typed_func::<(), (), _>(&mut *store, &self.init_func)
            .expect("checked by `validate_init_func`");
        init_func
            .call(&mut *store, ())
            .with_context(|| format!("the `{}` function trapped", self.init_func))?;
        Ok(instance)
    }
fn initialize ( & self , store : & mut Store , module : & wasmtime :: Module , ) -> anyhow :: Result < wasmtime :: Instance > { log :: debug ! ( " " ) ; let mut linker = wasmtime :: Linker :: new ( store . engine ( ) ) ; if self . allow_wasi { wasmtime_wasi :: add_to_linker ( & mut linker , | ctx : & mut Option < WasiCtx > | { ctx . as_mut ( ) . unwrap ( ) } ) ? ; } dummy_imports ( & mut * store , & module , & mut linker ) ? ; let instance = linker . instantiate ( & mut * store , module ) . context ( " " ) ? ; let init_func = instance . get_typed_func :: < ( ) , ( ) , _ > ( & mut * store , & self . init_func ) . expect ( " " ) ; init_func . call ( & mut * store , ( ) ) . with_context ( | | format ! ( " " self init_func ) ) ? ; Ok ( instance ) }
Instantiate the module and call its initialization function.
Instantiate the module and call its initialization function .
&self
store
&mut Store
module
&wasmtime::Module
&self
store
&mut Store
module
&wasmtime::Module