Function uniffi::call_with_output

source ·
pub fn call_with_output<F, R>(out_status: &mut RustCallStatus, callback: F) -> Rwhere
    F: UnwindSafe + FnOnce() -> R,
    R: FfiDefault,
Expand description

Wrap a rust function call and return the result directly

callback is responsible for making the call to the Rust function. It must convert any return value into a type that implements IntoFfi (typically handled with FfiConverter::lower()).

  • If the function succeeds then the function’s return value will be returned to the outer code
  • If the function panics:
    • out_status.code will be set to CALL_PANIC
    • the return value is undefined