Replies: 2 comments
-
fn uuid_to_java<'local>(
env: &mut JNIEnv<'local>,
uuid: u128,
) -> jni::errors::Result<JObject<'local>> {
let upper = (uuid >> 64) as u64 as i64;
let lower = uuid as u64 as i64;
env.new_object("java/util/UUID", "(JJ)V", &[upper.into(), lower.into()])
} |
Beta Was this translation helpful? Give feedback.
0 replies
-
I was getting ready to use fromString but this is even better. Thanks! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Java has a type called "java.util.UUID" which, despite its fancy methods, is functionally equivalent Rust's
u128
type. So I was hoping this would work:It does not.
This would obviously be worth opening a feature request for but I was curious if there was some sort of hack or alternative code I could try?
Beta Was this translation helpful? Give feedback.
All reactions