Crate rust_jni[][src]

A library for safe interoperation between Rust and Java

rust-jni provides tools to safely make calls from Rust to Java and from Java to Rust using JNI.

The main philosofy of this library is to push as many errors to compile-time as possible and panic whenever it's impossible to have a compile error.

Modules

java

Macros

java_class

Generate Java class wrapper.

java_interface

Generate Java interface wrapper.

Structs

AttachArguments

Arguments for attaching a thread to the JVM.

Exception

A dual token to NoException that represents that there might be a pending exception in Java.

InitArguments

Arguments for creating a Java VM.

JavaVM

A struct for interacting with the Java VM.

JniEnv

The interface for interacting with Java. All calls to Java are performed through this interface. JNI methods can only be called from threads, explicitly attached to the Java VM. JniEnv represents such a thread.

NoException

A token that represents that there is no pending Java exception in the current thread.

Enums

JniError

Errors returned by JNI function.

JniVersion

JNI Version enum.

JvmOption

Options for starting a Java VM.

JvmVerboseOption

Verbose options for starting a Java VM.

Traits

Cast

A trait for casting Java object types to their superclasses.

JavaType

A trait that represents Rust types that are mappable to JNI types. This trait has to be implemented for all types that need to be passed as arguments to or returned from Java functions.

Type Definitions

JavaResult

A type that represents a result of a Java method call. A Java method can either return a result or throw a Throwable.