MCPcopy Create free account
hub / github.com/astonbitecode/j4rs / do_return

Function do_return

rust/src/api_tweaks/android.rs:151–162  ·  view source on GitHub ↗
(jni_env: *mut JNIEnv, to_return: T, message: &str)

Source from the content-addressed store, hash-verified

149}
150
151fn do_return<T>(jni_env: *mut JNIEnv, to_return: T, message: &str) -> errors::Result<T> {
152 unsafe {
153 if (opt_to_res(cache::get_jni_exception_check())?)(jni_env) == JNI_TRUE {
154 (opt_to_res(cache::get_jni_exception_clear())?)(jni_env);
155 Err(errors::J4RsError::JavaError(format!(
156 "Class not found {message}"
157 )))
158 } else {
159 Ok(to_return)
160 }
161 }
162}
163
164pub(crate) struct J4rsAndroidJavaVM {
165 java_vm: *mut JavaVM,

Callers 15

jstring_to_rust_stringFunction · 0.85
invoke_asyncMethod · 0.85
handle_channel_senderMethod · 0.85
create_instanceMethod · 0.85
static_classMethod · 0.85
create_java_arrayMethod · 0.85
do_create_java_listMethod · 0.85
do_create_java_mapMethod · 0.85
invokeMethod · 0.85

Calls 3

opt_to_resFunction · 0.85
get_jni_exception_checkFunction · 0.85
get_jni_exception_clearFunction · 0.85

Tested by

no test coverage detected