Attribute Macro javawithrust::jfuncs
source · [−]#[jfuncs]
Expand description
Define static Java class functions to bind.
Examples
// Rust
use javawithrust::prelude::*;
#[jclass(io.example.MyJavaClass)]
struct MyJavaClass;
#[jfuncs]
impl J2RS {
// If no body is provided, this will be a rust-to-java function.
fn hello();
// If a body is provided, this will be a java-to-rust function.
// However, this can still be called in Rust using `ClassName::funcName`.
fn sum(a : i32, b : i32) -> /*Result<*/i32/*, String>*/ {
return Ok(a + b);
}
}