-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for Option<T>? #15
Comments
I'm trying to make it myself, but it's not complete yet!!! https://github.com/EchidnaHQ/robusta It involves lots of unholy magics like patching the |
Hi @lovelyyfiaaa, thank you for bringing up this issue! I had a look at your commits and they seem fine. Given that there is also a compiler bug that you're fighting with I don't think we can hope for a better solution for the time being. Another option would be to special-case |
Yeah, sure!! Umm, I think we should go with the JOption enum for now? I too dislike it, but it seems it's the only option.. |
Yeah, for now you can go on and just open a PR with |
Is it using |
So any idea how to cope with nullables returned from java side? |
as a temporary workaround I use: fn opt<T>(r: JniResult<T>) -> JniResult<Option<T>> {
match r {
Ok(value) => { Ok(Some(value)) }
Err(NullPtr(&_)) => { Ok(None) }
Err(e) => { Err(e) }
}
} it works well if java/kotlin side returns null, but it most likely will also misreport NPE on java side as returning null. See no better solution yet. |
Hiiii <3
Will this project support passing Option to JNI? There are many APIs in the Android Sdk that might involve nullable values, soo this would help a lot!!!
The text was updated successfully, but these errors were encountered: