jni-mangle

Crates.iojni-mangle
lib.rsjni-mangle
version0.1.2
sourcesrc
created_at2023-09-07 16:57:26.918037
updated_at2023-09-07 17:22:58.016524
descriptionMangle Rust functions for use with JNI
homepagehttps://github.com/ewpratten/jni-mangle
repositoryhttps://github.com/ewpratten/jni-mangle
max_upload_size
id966398
size56,858
Evan Pratten (ewpratten)

documentation

https://docs.rs/jni-mangle

README

Rust function mangler for JNI

Crates.io Docs.rs Build Clippy

The jni-mangle crate provides proc macros for working with Rust functions that are called from Java through JNI.

The main purpose of this crate is to turn rust functions that might look like this:

#[no_mangle]
#[allow(non_snake_case)]
pub extern "system" fn Java_com_example_Example_addTwoNumbers(a: i32, b: i32) -> i32 {
   a + b    
}

Into something a little more readable:

use jni_mangle::mangle;

#[mangle(package="com.example", class="Example", method="addTwoNumbers")]
pub fn add_two_numbers(a: i32, b: i32) -> i32 {
   a + b    
}
Commit count: 12

cargo fmt