Trait robusta_jni::convert::safe::TryFromJavaValue [−][src]
Conversion trait from Java values to Rust values, analogous to TryFrom. Used when converting types that are input to JNI-available functions.
This is the default trait used when converting values from Java to Rust.
Notes on the derive macro
When using the derive macro, the deriving struct must have a AutoLocal
field annotated with both 'env
and 'borrow
lifetimes and a #[instance]
attribute.
This fields keeps a local reference to the underlying Java object.
All other fields are automatically initialized from fields on the Java instance with the same name.
Example:
use robusta_jni::convert::{Signature, TryFromJavaValue}; use robusta_jni::jni::objects::AutoLocal; #[derive(Signature, TryFromJavaValue)] #[package()] struct A<'env: 'borrow, 'borrow> { #[instance] raw: AutoLocal<'env, 'borrow>, foo: i32 }
Associated Types
Loading content...Associated Constants
Loading content...Required methods
fn try_from(s: Self::Source, env: &'borrow JNIEnv<'env>) -> Result<Self>
[src]
Perform the conversion.
Implementations on Foreign Types
impl<'env: 'borrow, 'borrow> TryFromJavaValue<'env, 'borrow> for String
[src]
type Source = JString<'env>
fn try_from(s: Self::Source, env: &'borrow JNIEnv<'env>) -> Result<Self>
[src]
impl<'env: 'borrow, 'borrow> TryFromJavaValue<'env, 'borrow> for bool
[src]
impl<'env: 'borrow, 'borrow> TryFromJavaValue<'env, 'borrow> for char
[src]
impl<'env: 'borrow, 'borrow> TryFromJavaValue<'env, 'borrow> for Box<[bool]>
[src]
type Source = jbooleanArray
fn try_from(s: Self::Source, env: &'borrow JNIEnv<'env>) -> Result<Self>
[src]
impl<'env: 'borrow, 'borrow, T, U> TryFromJavaValue<'env, 'borrow> for Vec<T> where
T: TryFromJavaValue<'env, 'borrow, Source = U>,
U: JavaValue<'env>,
[src]
T: TryFromJavaValue<'env, 'borrow, Source = U>,
U: JavaValue<'env>,
type Source = JObject<'env>
fn try_from(s: Self::Source, env: &'borrow JNIEnv<'env>) -> Result<Self>
[src]
Implementors
impl<'env: 'borrow, 'borrow, T> TryFromJavaValue<'env, 'borrow> for T where
T: JavaValue<'env> + Signature,
[src]
T: JavaValue<'env> + Signature,