pub fn new(store: &Store, module: &Module, imports: &[Extern]) -> Result<Instance, Error> {
        if !Engine::same(store.engine(), module.engine()) {
            bail!("cross-`Engine` instantiation is not currently supported");
        }

        store.register_module(&module);
        let host_info = Box::new(module.register_frame_info());

        let handle = with_imports(store, module.compiled_module(), imports, |imports| {
            instantiate(store, module.compiled_module(), imports, host_info)
        })?;

        Ok(Instance {
            handle,
            store: store.clone(),
            module: module.clone(),
        })
    }
/// Creates a new [`Instance`] from the previously compiled [`Module`] and
/// list of `imports` specified.
///
/// This method instantiates the `module` provided with the `imports`,
/// following the procedure in the [core specification][inst] to
/// instantiate. Instantiation can fail for a number of reasons (many
/// specified below), but if successful the `start` function will be
/// automatically run (if provided) and then the [`Instance`] will be
/// returned.
///
/// Per the WebAssembly spec, instantiation includes running the module's
/// start function, if it has one (not to be confused with the `_start`
/// function, which is not run).
///
/// Note that this is a low-level function that just performance an
/// instantiation. See the `Linker` struct for an API which provides a
/// convenient way to link imports and provides automatic Command and Reactor
/// behavior.
///
/// ## Providing Imports
///
/// The `imports` array here is a bit tricky. The entries in the list of
/// `imports` are intended to correspond 1:1 with the list of imports
/// returned by [`Module::imports`]. Before calling [`Instance::new`] you'll
/// want to inspect the return value of [`Module::imports`] and, for each
/// import type, create an [`Extern`] which corresponds to that type.
/// These [`Extern`] values are all then collected into a list and passed to
/// this function.
///
/// Note that this function is intentionally relatively low level. It is the
/// intention that we'll soon provide a [higher level API][issue] which will
/// be much more ergonomic for instantiating modules. If you need the full
/// power of customization of imports, though, this is the method for you!
///
/// ## Errors
///
/// This function can fail for a number of reasons, including, but not
/// limited to:
///
/// * The number of `imports` provided doesn't match the number of imports
///   returned by the `module`'s [`Module::imports`] method.
/// * The type of any [`Extern`] doesn't match the corresponding
///   [`ExternType`] entry that it maps to.
/// * The `start` function in the instance, if present, traps.
/// * Module/instance resource limits are exceeded.
///
/// When instantiation fails it's recommended to inspect the return value to
/// see why it failed, or bubble it upwards. If you'd like to specifically
/// check for trap errors, you can use `error.downcast::<Trap>()`.
///
/// [inst]: https://webassembly.github.io/spec/core/exec/modules.html#exec-instantiation
/// [issue]: https://github.com/bytecodealliance/wasmtime/issues/727
/// [`ExternType`]: crate::ExternType


This method instantiates the `module` provided with the `imports`,
following the procedure in the [core specification][inst] to
instantiate. Instantiation can fail for a number of reasons (many
specified below), but if successful the `start` function will be
automatically run (if provided) and then the [`Instance`] will be
returned.

Per the WebAssembly spec, instantiation includes running the module's
start function, if it has one (not to be confused with the `_start`
function, which is not run).

Note that this is a low-level function that just performance an
instantiation. See the `Linker` struct for an API which provides a
convenient way to link imports and provides automatic Command and Reactor
behavior.
This method instantiates the ` module ` provided with the ` imports ` following the procedure in the [ core specification ] [ inst ] to instantiate . Instantiation can fail for a number of reasons ( many specified below ) but if successful the ` start ` function will be automatically run ( if provided ) and then the [ ` Instance ` ] will be returned . Per the WebAssembly spec instantiation includes running the module ' s start function if it has one ( not to be confused with the ` _start ` function which is not run ) . Note that this is a low - level function that just performance an instantiation . See the ` Linker ` struct for an API which provides a convenient way to link imports and provides automatic Command and Reactor behavior .
pub fn new(store: &Store, module: &Module, imports: &[Extern]) -> Result<Instance, Error> {
        if !Engine::same(store.engine(), module.engine()) {
            bail!("cross-`Engine` instantiation is not currently supported");
        }
        store.register_module(&module);
        let host_info = Box::new(module.register_frame_info());
        let handle = with_imports(store, module.compiled_module(), imports, |imports| {
            instantiate(store, module.compiled_module(), imports, host_info)
        })?;
        Ok(Instance {
            handle,
            store: store.clone(),
            module: module.clone(),
        })
    }
pub fn new ( store : & Store , module : & Module , imports : & [ Extern ] ) -> Result < Instance , Error > { if ! Engine :: same ( store . engine ( ) , module . engine ( ) ) { bail ! ( " " ) ; } store . register_module ( & module ) ; let host_info = Box :: new ( module . register_frame_info ( ) ) ; let handle = with_imports ( store , module . compiled_module ( ) , imports , | imports | { instantiate ( store , module . compiled_module ( ) , imports , host_info ) } ) ? ; Ok ( Instance { handle , store : store . clone ( ) , module : module . clone ( ) , } ) }
Creates a new [`Instance`] from the previously compiled [`Module`] and
list of `imports` specified.
Creates a new [ ` Instance ` ] from the previously compiled [ ` Module ` ] and list of ` imports ` specified .
store
&Store
module
&Module
imports
&[Extern]
store
&Store
module
&Module
imports
&[Extern]
providing imports
The `imports` array here is a bit tricky. The entries in the list of
`imports` are intended to correspond 1:1 with the list of imports
returned by [`Module::imports`]. Before calling [`Instance::new`] you'll
want to inspect the return value of [`Module::imports`] and, for each
import type, create an [`Extern`] which corresponds to that type.
These [`Extern`] values are all then collected into a list and passed to
this function.

Note that this function is intentionally relatively low level. It is the
intention that we'll soon provide a [higher level API][issue] which will
be much more ergonomic for instantiating modules. If you need the full
power of customization of imports, though, this is the method for you!
The ` imports ` array here is a bit tricky . The entries in the list of ` imports ` are intended to correspond 1 : 1 with the list of imports returned by [ ` Module :: imports ` ] . Before calling [ ` Instance :: new ` ] you ' ll want to inspect the return value of [ ` Module :: imports ` ] and for each import type create an [ ` Extern ` ] which corresponds to that type . These [ ` Extern ` ] values are all then collected into a list and passed to this function . Note that this function is intentionally relatively low level . It is the intention that we ' ll soon provide a [ higher level API ] [ issue ] which will be much more ergonomic for instantiating modules . If you need the full power of customization of imports though this is the method for you!
errors
This function can fail for a number of reasons, including, but not
limited to.

The number of `imports` provided doesn't match the number of imports
returned by the `module`'s [`Module::imports`] method.
The type of any [`Extern`] doesn't match the corresponding
[`ExternType`] entry that it maps to.
The `start` function in the instance, if present, traps.
Module/instance resource limits are exceeded.

When instantiation fails it's recommended to inspect the return value to
see why it failed, or bubble it upwards. If you'd like to specifically
check for trap errors, you can use `error.downcast::()`.


This function can fail for a number of reasons including but not limited to . The number of ` imports ` provided doesn ' t match the number of imports returned by the ` module ` ' s [ ` Module :: imports ` ] method . The type of any [ ` Extern ` ] doesn ' t match the corresponding [ ` ExternType ` ] entry that it maps to . The ` start ` function in the instance if present traps . Module / instance resource limits are exceeded . When instantiation fails it ' s recommended to inspect the return value to see why it failed or bubble it upwards . If you ' d like to specifically check for trap errors you can use ` error . downcast :: () ` .