MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / handle_instantiate

Function handle_instantiate

crates/c-api/src/instance.rs:93–113  ·  view source on GitHub ↗
(
    instance: wasmtime::Result<Instance>,
    instance_ptr: &mut Instance,
    trap_ptr: &mut *mut wasm_trap_t,
)

Source from the content-addressed store, hash-verified

91}
92
93pub(crate) fn handle_instantiate(
94 instance: wasmtime::Result<Instance>,
95 instance_ptr: &mut Instance,
96 trap_ptr: &mut *mut wasm_trap_t,
97) -> Option<Box<wasmtime_error_t>> {
98 *trap_ptr = ptr::null_mut();
99 match instance {
100 Ok(i) => {
101 *instance_ptr = i;
102 None
103 }
104 Err(e) => {
105 if e.is::<Trap>() {
106 *trap_ptr = Box::into_raw(Box::new(wasm_trap_t::new(e)));
107 None
108 } else {
109 Some(Box::new(e.into()))
110 }
111 }
112 }
113}
114
115#[unsafe(no_mangle)]
116pub unsafe extern "C" fn wasmtime_instance_export_get(

Callers 3

wasmtime_instance_newFunction · 0.85

Calls 1

newFunction · 0.50

Tested by

no test coverage detected