pub fn run_instance(
    module: &Module,
    instance: &mut Instance,
    abi: InstanceABI,
    path: &str,
    args: Vec<&str>,
) -> CallResult<()> {
    match abi {
        InstanceABI::Emscripten => {
            run_emscripten_instance(module, instance, path, args)?;
        }
        InstanceABI::WASI => {
            instance.call("_start", &[])?;
        }
        InstanceABI::None => {
            let args: Vec<Value> = args
                .into_iter()
                .map(|x| Value::I32(x.parse().unwrap()))
                .collect();
            instance.call("main", &args)?;
        }
    }
    Ok(())
}
/// Performs common instance operations needed when an instance is first run
/// including data setup, handling arguments and calling a main function
Performs common instance operations needed when an instance is first run
including data setup, handling arguments and calling a main function
Performs common instance operations needed when an instance is first run including data setup handling arguments and calling a main function
pub fn run_instance(
    module: &Module,
    instance: &mut Instance,
    abi: InstanceABI,
    path: &str,
    args: Vec<&str>,
) -> CallResult<()> {
    match abi {
        InstanceABI::Emscripten => {
            run_emscripten_instance(module, instance, path, args)?;
        }
        InstanceABI::WASI => {
            instance.call("_start", &[])?;
        }
        InstanceABI::None => {
            let args: Vec<Value> = args
                .into_iter()
                .map(|x| Value::I32(x.parse().unwrap()))
                .collect();
            instance.call("main", &args)?;
        }
    }
    Ok(())
}
pub fn run_instance ( module : & Module , instance : & mut Instance , abi : InstanceABI , path : & str , args : Vec < & str > , ) -> CallResult < ( ) > { match abi { InstanceABI :: Emscripten => { run_emscripten_instance ( module , instance , path , args ) ? ; } InstanceABI :: WASI => { instance . call ( " " , & [ ] ) ? ; } InstanceABI :: None => { let args : Vec < Value > = args . into_iter ( ) . map ( | x | Value :: I32 ( x . parse ( ) . unwrap ( ) ) ) . collect ( ) ; instance . call ( " " , & args ) ? ; } } Ok ( ( ) ) }
Performs common instance operations needed when an instance is first run
including data setup, handling arguments and calling a main function
Performs common instance operations needed when an instance is first run including data setup handling arguments and calling a main function
module
&Module
instance
&mut Instance
abi
InstanceABI
path
&str
args
Vec<&str>
module
&Module
instance
&mut Instance
abi
InstanceABI
path
&str
args
Vec<&str>