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

Function wasm_memory_new

crates/c-api/src/memory.rs:35–46  ·  view source on GitHub ↗
(
    store: &mut wasm_store_t,
    mt: &wasm_memorytype_t,
)

Source from the content-addressed store, hash-verified

33
34#[unsafe(no_mangle)]
35pub unsafe extern "C" fn wasm_memory_new(
36 store: &mut wasm_store_t,
37 mt: &wasm_memorytype_t,
38) -> Option<Box<wasm_memory_t>> {
39 let memory = Memory::new(store.store.context_mut(), mt.ty().ty.clone()).ok()?;
40 Some(Box::new(wasm_memory_t {
41 ext: wasm_extern_t {
42 store: store.store.clone(),
43 which: memory.into(),
44 },
45 }))
46}
47
48#[unsafe(no_mangle)]
49pub extern "C" fn wasm_memory_as_extern(m: &mut wasm_memory_t) -> &mut wasm_extern_t {

Callers

nothing calls this directly

Calls 5

context_mutMethod · 0.80
newFunction · 0.50
okMethod · 0.45
cloneMethod · 0.45
tyMethod · 0.45

Tested by

no test coverage detected