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

Function wasmtime_val_clone

crates/c-api/src/val.rs:403–432  ·  view source on GitHub ↗
(
    src: &wasmtime_val_t,
    dst: &mut MaybeUninit<wasmtime_val_t>,
)

Source from the content-addressed store, hash-verified

401
402#[unsafe(no_mangle)]
403pub unsafe extern "C" fn wasmtime_val_clone(
404 src: &wasmtime_val_t,
405 dst: &mut MaybeUninit<wasmtime_val_t>,
406) {
407 let of = match src.kind {
408 #[cfg(feature = "gc")]
409 crate::WASMTIME_ANYREF => wasmtime_val_union {
410 anyref: ManuallyDrop::new(src.of.anyref.as_wasmtime().into()),
411 },
412 #[cfg(feature = "gc")]
413 crate::WASMTIME_EXTERNREF => wasmtime_val_union {
414 externref: ManuallyDrop::new(src.of.externref.as_wasmtime().into()),
415 },
416 #[cfg(feature = "gc")]
417 crate::WASMTIME_EXNREF => wasmtime_val_union {
418 exnref: ManuallyDrop::new(src.of.exnref.as_wasmtime().into()),
419 },
420 crate::WASMTIME_I32 => wasmtime_val_union { i32: src.of.i32 },
421 crate::WASMTIME_I64 => wasmtime_val_union { i64: src.of.i64 },
422 crate::WASMTIME_F32 => wasmtime_val_union { f32: src.of.f32 },
423 crate::WASMTIME_F64 => wasmtime_val_union { f64: src.of.f64 },
424 crate::WASMTIME_V128 => wasmtime_val_union { v128: src.of.v128 },
425 #[cfg(feature = "gc")]
426 crate::WASMTIME_FUNCREF => wasmtime_val_union {
427 funcref: src.of.funcref,
428 },
429 _ => unreachable!(),
430 };
431 dst.write(wasmtime_val_t { kind: src.kind, of });
432}

Callers 2

ValMethod · 0.85
ValClass · 0.85

Calls 3

as_wasmtimeMethod · 0.80
newFunction · 0.50
writeMethod · 0.45

Tested by

no test coverage detected