pub fn instantiate(buffer_source: &[u8], import_object: ImportObject) -> Result<ResultObject> {
    debug!("webassembly - compiling module");
    let module = compile(&buffer_source[..])?;

    debug!("webassembly - instantiating");
    let instance = module.instantiate(&import_object)?;

    debug!("webassembly - instance created");
    Ok(ResultObject {
        module,
        instance: Box::new(instance),
    })
}
/// The webassembly::instantiate() function allows you to compile and
/// instantiate WebAssembly code
/// Params:
/// * `buffer_source`: A `Vec<u8>` containing the
///   binary code of the .wasm module you want to compile.
/// * `import_object`: An object containing the values to be imported
///   into the newly-created Instance, such as functions or
///   webassembly::Memory objects. There must be one matching property
///   for each declared import of the compiled module or else a
///   webassembly::LinkError is thrown.
/// Errors:
/// If the operation fails, the Result rejects with a
/// webassembly::CompileError, webassembly::LinkError, or
/// webassembly::RuntimeError, depending on the cause of the failure.
The webassembly::instantiate() function allows you to compile and
instantiate WebAssembly code
Params:
`buffer_source`: A `Vec` containing the
binary code of the .wasm module you want to compile.
`import_object`: An object containing the values to be imported
into the newly-created Instance, such as functions or
webassembly::Memory objects. There must be one matching property
for each declared import of the compiled module or else a
webassembly::LinkError is thrown.
The webassembly :: instantiate () function allows you to compile and instantiate WebAssembly code Params : ` buffer_source ` : A ` Vec ` containing the binary code of the . wasm module you want to compile . ` import_object ` : An object containing the values to be imported into the newly - created Instance such as functions or webassembly :: Memory objects . There must be one matching property for each declared import of the compiled module or else a webassembly :: LinkError is thrown .
pub fn instantiate(buffer_source: &[u8], import_object: ImportObject) -> Result<ResultObject> {
    debug!("webassembly - compiling module");
    let module = compile(&buffer_source[..])?;
    debug!("webassembly - instantiating");
    let instance = module.instantiate(&import_object)?;
    debug!("webassembly - instance created");
    Ok(ResultObject {
        module,
        instance: Box::new(instance),
    })
}
pub fn instantiate ( buffer_source : & [ u8 ] , import_object : ImportObject ) -> Result < ResultObject > { debug ! ( " " ) ; let module = compile ( & buffer_source [ .. ] ) ? ; debug ! ( " " ) ; let instance = module . instantiate ( & import_object ) ? ; debug ! ( " " ) ; Ok ( ResultObject { module , instance : Box :: new ( instance ) , } ) }
The webassembly::instantiate() function allows you to compile and
instantiate WebAssembly code
Params:
 `buffer_source`: A `Vec<u8>` containing the
binary code of the .wasm module you want to compile.
The webassembly :: instantiate () function allows you to compile and instantiate WebAssembly code Params : ` buffer_source ` : A ` Vec<u8 > ` containing the binary code of the . wasm module you want to compile .
buffer_source
&[u8]
import_object
ImportObject
buffer_source
&[u8]
import_object
ImportObject