pub fn new(
        mut store: impl AsContextMut,
        module: &Module,
        imports: &[Extern],
    ) -> Result<Instance, Error> {
        // This unsafety comes from `Instantiator::new` where we must typecheck
        // first, which we are sure to do here.
        let mut store = store.as_context_mut();
        let mut i = unsafe {
            typecheck_externs(store.0, module, imports)?;
            Instantiator::new(store.0, module, ImportSource::Externs(imports))?
        };
        assert!(
            !store.0.async_support(),
            "cannot use `new` when async support is enabled on the config"
        );

        i.run(&mut store)
    }
/// 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 specified in the `module`) 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 performs an
/// instantiation. See the [`Linker`](crate::Linker) struct for an API which
/// provides a convenient way to link imports and provides automatic Command
/// and Reactor behavior.
///
/// ## Providing Imports
///
/// 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. For an
/// easier time passing imports by doing name-based resolution it's
/// recommended to instead use the [`Linker`](crate::Linker) type.
///
/// ## 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>()`.
///
/// # Panics
///
/// This function will panic if called with a store associated with a
/// [`asynchronous config`](crate::Config::async_support). This function
/// will also panic if any [`Extern`] supplied is not owned by `store`.
///
/// [inst]: https://webassembly.github.io/spec/core/exec/modules.html#exec-instantiation
/// [`ExternType`]: crate::ExternType


This method instantiates the `module` provided with the `imports`,
following the procedure in the [core specification][inst] to
instantiate.

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 performs an
instantiation. See the [`Linker`](crate::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 . 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 performs an instantiation . See the [ ` Linker ` ] ( crate :: Linker ) struct for an API which provides a convenient way to link imports and provides automatic Command and Reactor behavior .
pub fn new(
        mut store: impl AsContextMut,
        module: &Module,
        imports: &[Extern],
    ) -> Result<Instance, Error> {
        // This unsafety comes from `Instantiator::new` where we must typecheck
        // first, which we are sure to do here.
        let mut store = store.as_context_mut();
        let mut i = unsafe {
            typecheck_externs(store.0, module, imports)?;
            Instantiator::new(store.0, module, ImportSource::Externs(imports))?
        };
        assert!(
            !store.0.async_support(),
            "cannot use `new` when async support is enabled on the config"
        );
        i.run(&mut store)
    }
pub fn new ( mut store : impl AsContextMut , module : & Module , imports : & [ Extern ] , ) -> Result < Instance , Error > { // This unsafety comes from `Instantiator::new` where we must typecheck // first, which we are sure to do here. let mut store = store . as_context_mut ( ) ; let mut i = unsafe { typecheck_externs ( store . 0 , module , imports ) ? ; Instantiator :: new ( store . 0 , module , ImportSource :: Externs ( imports ) ) ? } ; assert ! ( store 0 async_support ( ) " " ) ; i . run ( & mut store ) }
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
impl AsContextMut
module
&Module
imports
&[Extern]
store
impl AsContextMut
module
&Module
imports
&[Extern]
providing imports
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. For an
easier time passing imports by doing name-based resolution it's
recommended to instead use the [`Linker`](crate::Linker) type.
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 . For an easier time passing imports by doing name - based resolution it ' s recommended to instead use the [ ` Linker ` ] ( crate :: Linker ) type .
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 :: () ` .
panics
This function will panic if called with a store associated with a
[`asynchronous config`](crate::Config::async_support). This function
will also panic if any [`Extern`] supplied is not owned by `store`.


This function will panic if called with a store associated with a [ ` asynchronous config ` ] ( crate :: Config :: async_support ) . This function will also panic if any [ ` Extern ` ] supplied is not owned by ` store ` .