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

Function wasmtime_trap_new

crates/c-api/src/trap.rs:114–120  ·  view source on GitHub ↗
(message: *const u8, len: usize)

Source from the content-addressed store, hash-verified

112
113#[unsafe(no_mangle)]
114pub unsafe extern "C" fn wasmtime_trap_new(message: *const u8, len: usize) -> Box<wasm_trap_t> {
115 let bytes = crate::slice_from_raw_parts(message, len);
116 let message = String::from_utf8_lossy(&bytes);
117 Box::new(wasm_trap_t {
118 error: Error::msg(message.into_owned()),
119 })
120}
121
122#[unsafe(no_mangle)]
123pub unsafe extern "C" fn wasmtime_trap_new_code(code: u8) -> Box<wasm_trap_t> {

Callers 2

TrapMethod · 0.85

Calls 4

slice_from_raw_partsFunction · 0.85
msgFunction · 0.85
into_ownedMethod · 0.80
newFunction · 0.50

Tested by

no test coverage detected