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

Function wasmtime_global_new

crates/c-api/src/global.rs:83–97  ·  view source on GitHub ↗
(
    mut store: WasmtimeStoreContextMut<'_>,
    gt: &wasm_globaltype_t,
    val: &wasmtime_val_t,
    ret: &mut Global,
)

Source from the content-addressed store, hash-verified

81
82#[unsafe(no_mangle)]
83pub unsafe extern "C" fn wasmtime_global_new(
84 mut store: WasmtimeStoreContextMut<'_>,
85 gt: &wasm_globaltype_t,
86 val: &wasmtime_val_t,
87 ret: &mut Global,
88) -> Option<Box<wasmtime_error_t>> {
89 #[cfg(feature = "gc")]
90 let mut store = RootScope::new(&mut store);
91
92 let val = val.to_val(&mut store);
93 let global = Global::new(&mut store, gt.ty().ty.clone(), val);
94 handle_result(global, |global| {
95 *ret = global;
96 })
97}
98
99#[unsafe(no_mangle)]
100pub extern "C" fn wasmtime_global_type(

Callers 1

createMethod · 0.85

Calls 5

handle_resultFunction · 0.85
to_valMethod · 0.80
newFunction · 0.50
cloneMethod · 0.45
tyMethod · 0.45

Tested by

no test coverage detected