-
Hi, I need to process a JString value passed as method argument, which may or may not be null. Here's a rough outline of how I imagine my code might look like. (Although the
I couldn't find any documentation on how jni-rs suggests to deal handling null values. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
You can use There has been discussion in the past around whether to use Here's one of the older discussions I was thinking of: #148 |
Beta Was this translation helpful? Give feedback.
-
I ended up unwrapping the JString variable into and Option:
So when my java method gets called with the String parameter set to null: |
Beta Was this translation helpful? Give feedback.
I ended up unwrapping the JString variable into and Option:
So when my java method gets called with the String parameter set to null:
(new MyClass()).myMethod(null)
it'll convert to Option::None on the rust side.