(
msg: *const std::ffi::c_char,
)
| 22 | |
| 23 | #[unsafe(no_mangle)] |
| 24 | pub extern "C" fn wasmtime_error_new( |
| 25 | msg: *const std::ffi::c_char, |
| 26 | ) -> Option<Box<wasmtime_error_t>> { |
| 27 | let msg_bytes = unsafe { std::ffi::CStr::from_ptr(msg).to_bytes() }; |
| 28 | let msg_string = String::from_utf8_lossy(msg_bytes).into_owned(); |
| 29 | Some(Box::new(wasmtime_error_t::from(format_err!(msg_string)))) |
| 30 | } |
| 31 | |
| 32 | pub(crate) fn handle_result<T>( |
| 33 | result: Result<T>, |
no test coverage detected