[][src]Function ffi_support::call_with_output

pub fn call_with_output<R, F>(
    out_error: &mut ExternError,
    callback: F
) -> R::Value where
    F: UnwindSafe + FnOnce() -> R,
    R: IntoFfi

Call a callback that returns a T while:

  • Catching panics, and reporting them to C via ExternError
  • Converting T to a C-compatible type using IntoFfi

Note that you still need to provide an ExternError to this function, to report panics.

See call_with_result if you'd like to return a Result<T, E> (Note: E must be convertible to ExternError).

This (or call_with_result) should be in the majority of the FFI functions, see the crate top-level docs for more info.