Archived
1
Fork 0
Mangle Rust functions for use with JNI
This repository has been archived on 2026-04-08. You can view files and clone it, but you cannot make any changes to its state, such as pushing and creating new issues, pull requests or comments.
Find a file
Evan Pratten 1c96023f8d
Some checks failed
Build / Rust project (push) Has been cancelled
Publish / Rust Crate (push) Has been cancelled
Remove deprecated logic around mangling generics
2026-04-08 16:25:22 -04:00
.forgejo/workflows Configure automated crate packaging 2026-02-13 14:13:26 -05:00
.vscode Initial commit 2023-09-06 10:31:33 -04:00
examples Remove deprecated logic around mangling generics 2026-04-08 16:25:22 -04:00
src Remove deprecated logic around mangling generics 2026-04-08 16:25:22 -04:00
.gitignore Initial commit 2023-09-06 10:31:33 -04:00
Cargo.toml Remove deprecated logic around mangling generics 2026-04-08 16:25:22 -04:00
LICENSE Initial commit 2023-09-06 10:31:33 -04:00
README.md Fix some spacing issues in docs 2023-09-07 12:59:47 -04:00

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    
}