• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 use alloc::boxed::Box;
2 use alloc::string::String;
3 use core::slice;
4 
5 #[export_name = "cxxbridge1$exception"]
exception(ptr: *const u8, len: usize) -> *const u86 unsafe extern "C" fn exception(ptr: *const u8, len: usize) -> *const u8 {
7     let slice = slice::from_raw_parts(ptr, len);
8     let boxed = String::from_utf8_lossy(slice).into_owned().into_boxed_str();
9     Box::leak(boxed).as_ptr()
10 }
11