Function fn_function

Source
pub fn fn_function<'a: 'b, 'b>(
    env: &'b JNIEnv<'a>,
    f: impl for<'c, 'd> Fn(&'d JNIEnv<'c>, JObject<'c>, JObject<'c>) -> JObject<'c> + Send + Sync + 'static,
) -> Result<JObject<'a>>
Expand description

Create an io.github.gedgygedgy.rust.ops.FnFunction from a given Fn. The closure can later be called by calling the object’s apply() method. The closure can be freed without calling it by calling the object’s close() method.

If the closure panics, the unwind will be caught and thrown as an io.github.gedgygedgy.rust.panic.PanicException.

It is safe to call the object’s apply() method recursively.