jnix
This crate provides high-level extensions to help with the usage of JNI in Rust code. Internally,
it uses the jni-rs crate for the low-level JNI operations.
Some helper traits are provided, such as:
AsJValue: for allowing a JNI type to be convected to aJValuewrapper type.IntoJava: for allowing a Rust type to be converted to a Java type.FromJava: for allowing a Rust type to be created from a Java type.
A JnixEnv helper type is also provided, which is a JNIEnv wrapper that contains an
internal class cache for preloaded classes.
If compiled with the derive feature flag, the crate also exports procedural macros to
derive IntoJava and to derive FromJava, which makes writing conversion code a lot
easier. An example would be:
use ;
// Rust type definition
// A JNI function called from Java that creates a `MyData` Rust type, converts it to a Java
// type and returns it.
pub extern "system"
;
License: Apache-2.0 OR MIT