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

Function wasmtime_externref_data

crates/c-api/src/externref.rs:33–44  ·  view source on GitHub ↗
(
    cx: WasmtimeStoreContextMut<'_>,
    externref: Option<&wasmtime_externref_t>,
)

Source from the content-addressed store, hash-verified

31
32#[unsafe(no_mangle)]
33pub unsafe extern "C" fn wasmtime_externref_data(
34 cx: WasmtimeStoreContextMut<'_>,
35 externref: Option<&wasmtime_externref_t>,
36) -> *mut c_void {
37 externref
38 .and_then(|e| e.as_wasmtime())
39 .and_then(|e| {
40 let data = e.data(cx).ok()??;
41 Some(data.downcast_ref::<crate::ForeignData>().unwrap().data)
42 })
43 .unwrap_or(core::ptr::null_mut())
44}

Callers 2

mainFunction · 0.85
ExternRefClass · 0.85

Calls 4

as_wasmtimeMethod · 0.80
okMethod · 0.45
dataMethod · 0.45
unwrapMethod · 0.45

Tested by

no test coverage detected