pub trait IntoJavaValue<'env>: Signature {
    type Target: JavaValue<'env>;

    const SIG_TYPE: &'static str = <Self as Signature>::SIG_TYPE;

    // Required method
    fn into(self, env: &JNIEnv<'env>) -> Self::Target;
}
Expand description

Conversion trait from Rust values to Java values, analogous to Into. Used when converting types returned from JNI-available functions.

The usage of this trait in the generated code can be enabled with the #[call_type(unchecked)] attribute on a per-method basis.

When using this trait the conversion is assumed to be infallible. Should a conversion fail, a panic will be raised.

Notes on the derive macro

The same notes on TryIntoJavaValue apply.

Required Associated Types§

source

type Target: JavaValue<'env>

Conversion target type.

Provided Associated Constants§

source

const SIG_TYPE: &'static str = <Self as Signature>::SIG_TYPE

Signature of the source type. By default, use the one defined on the Signature trait for the implementing type.

Required Methods§

source

fn into(self, env: &JNIEnv<'env>) -> Self::Target

Perform the conversion.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<'env> IntoJavaValue<'env> for bool

§

type Target = u8

source§

fn into(self, _env: &JNIEnv<'env>) -> Self::Target

source§

impl<'env> IntoJavaValue<'env> for char

§

type Target = u16

source§

fn into(self, _env: &JNIEnv<'env>) -> Self::Target

source§

impl<'env> IntoJavaValue<'env> for Box<[bool]>

§

type Target = *mut _jobject

source§

fn into(self, env: &JNIEnv<'env>) -> Self::Target

source§

impl<'env> IntoJavaValue<'env> for String

§

type Target = *mut _jobject

source§

fn into(self, env: &JNIEnv<'env>) -> Self::Target

source§

impl<'env, T> IntoJavaValue<'env> for Vec<T>where T: IntoJavaValue<'env>,

§

type Target = *mut _jobject

source§

fn into(self, env: &JNIEnv<'env>) -> Self::Target

source§

impl<'env, T> IntoJavaValue<'env> for Result<T>where T: IntoJavaValue<'env>,

§

type Target = <T as IntoJavaValue<'env>>::Target

source§

fn into(self, env: &JNIEnv<'env>) -> Self::Target

Implementors§

source§

impl<'env, T> IntoJavaValue<'env> for Twhere T: JavaValue<'env> + Signature,

§

type Target = T