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

Function wasm_trap_new

crates/c-api/src/trap.rs:99–111  ·  view source on GitHub ↗
(
    _store: &wasm_store_t,
    message: &wasm_message_t,
)

Source from the content-addressed store, hash-verified

97
98#[unsafe(no_mangle)]
99pub extern "C" fn wasm_trap_new(
100 _store: &wasm_store_t,
101 message: &wasm_message_t,
102) -> Box<wasm_trap_t> {
103 let message = message.as_slice();
104 if message[message.len() - 1] != 0 {
105 panic!("wasm_trap_new message stringz expected");
106 }
107 let message = String::from_utf8_lossy(&message[..message.len() - 1]);
108 Box::new(wasm_trap_t {
109 error: Error::msg(message.into_owned()),
110 })
111}
112
113#[unsafe(no_mangle)]
114pub unsafe extern "C" fn wasmtime_trap_new(message: *const u8, len: usize) -> Box<wasm_trap_t> {

Callers 1

wasm.hFile · 0.85

Calls 5

msgFunction · 0.85
into_ownedMethod · 0.80
newFunction · 0.50
as_sliceMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected