You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey. I was wondering what the current approach is to mix structs annotated with #[derive(Signature)] where the impl needs to have a method that accepts e.g. jni's jlongarray. I thought I could fall back to using jni directly by passing &JNIEnv but that does not seem to work if the remaining arguments are jobject.
Is there a way to disable the signature resolution for certain functions of a struct? Thank you.
What I tried so far is:
pubextern"jni"fndotProductArray<'env>(env:&'env JNIEnv,vector_a:LongArray<'env>,vector_b:LongArray<'env>,) -> i64{// Wrap the pointer to the java array into an AutoArray, which automatically// releases the pointer once the variable goes out of scope.super::dot_product(&vector_a.to_vec(env),&vector_b.to_vec(env))}
Also, would it be an option to separate the unbox and autobox into different traits, and only allow the unbox in the argument position and autobox for return types?
The text was updated successfully, but these errors were encountered:
Hi and thanks for the issue!
There is an old PR that's about to be merged (#7) that addresses this exact issue, you can see here what the resulting interface will be.
If you do have time to experiment could you also try using this branch and see if everything is working as you expected? I'd really appreciate that 🙂
Hey. I was wondering what the current approach is to mix structs annotated with
#[derive(Signature)]
where theimpl
needs to have a method that accepts e.g. jni'sjlongarray
. I thought I could fall back to using jni directly by passing&JNIEnv
but that does not seem to work if the remaining arguments arejobject
.Is there a way to disable the signature resolution for certain functions of a struct? Thank you.
What I tried so far is:
and
This works, however, I actually would like to avoid allocating a
Vec
. Do you have a suggestion?Maybe it would make sense to re-export https://docs.rs/jni/latest/jni/struct.JNIEnv.html#method.get_long_array_elements as well?
Also, would it be an option to separate the
unbox
andautobox
into different traits, and only allow theunbox
in the argument position andautobox
for return types?The text was updated successfully, but these errors were encountered: