Trait robusta_jni::convert::safe::TryIntoJavaValue
source · pub trait TryIntoJavaValue<'env>: Signature {
type Target: JavaValue<'env>;
const SIG_TYPE: &'static str = <Self as Signature>::SIG_TYPE;
// Required method
fn try_into(self, env: &JNIEnv<'env>) -> Result<Self::Target>;
}
Expand description
Conversion trait from Rust values to Java values, analogous to TryInto. Used when converting types returned from JNI-available functions.
This is the default trait used when converting values from Rust to Java.
Notes on derive macro
The same notes on TryFromJavaValue
apply.
Note that when autoderiving TryIntoJavaValue
for T
, an implementation for all of T
, &T
and &mut T
is generated (for ergonomics).
Required Associated Types§
Provided Associated Constants§
Required Methods§
Object Safety§
This trait is not object safe.
Implementations on Foreign Types§
source§impl<'env> TryIntoJavaValue<'env> for bool
impl<'env> TryIntoJavaValue<'env> for bool
source§impl<'env> TryIntoJavaValue<'env> for char
impl<'env> TryIntoJavaValue<'env> for char
source§impl<'env> TryIntoJavaValue<'env> for Box<[bool]>
impl<'env> TryIntoJavaValue<'env> for Box<[bool]>
source§impl<'env> TryIntoJavaValue<'env> for Box<[u8]>
impl<'env> TryIntoJavaValue<'env> for Box<[u8]>
source§impl<'env> TryIntoJavaValue<'env> for String
impl<'env> TryIntoJavaValue<'env> for String
source§impl<'env, T> TryIntoJavaValue<'env> for Vec<T>where
T: TryIntoJavaValue<'env>,
impl<'env, T> TryIntoJavaValue<'env> for Vec<T>where T: TryIntoJavaValue<'env>,
source§impl<'env, T> TryIntoJavaValue<'env> for Result<T>where
T: TryIntoJavaValue<'env>,
impl<'env, T> TryIntoJavaValue<'env> for Result<T>where T: TryIntoJavaValue<'env>,
When returning a jni::errors::Result
, if the returned variant is Ok(v)
then the value v
is returned as usual.
If the returned value is Err
, the Java exception specified in the #[call_type(safe)]
attribute is thrown
(by default java.lang.RuntimeException
)